informa |
clc f1=str2double(get(handles.edit2,'String')); f2=str2double(get(handles.edit4,'String')); f3=str2double(get(handles.edit6,'String')); A1=str2double(get(handles.edit1,'String')); A2=str2double(get(handles.edit3,'String')); A3=str2double(get(handles.edit5,'String')); fmin=min([f1 f2 f3]); fmax=2*max([f1 f2 f3]); tz=4/fmin; tz=0.1; t=[0:tz/1024:tz-tz/1024]; axes(handles.axes1); df=1/tz; x=A1*cos(2*pi*f1*t)+A2*cos(2*pi*f2*t)+A3*cos(2*pi*f3*t); plot(t,x) grid on f=[0:df:39*df]; y=fft(x); m=abs(y)/512; m=m(1:40); axes(handles.axes2) bar(f,m) grid on |