t=0:0.1:20.5;
N=length(t);
dt=t(2)-t(1);
f1=11;
f2=1/3;
f3=3;
f4=1;
x=5*sin(2*pi*t*f1)+3*cos(2*pi*t*f2)+2*sin(2*pi*t*f3)+1*sin(2*pi*t*f4);
w=(0.54-0.46*cos(2*pi*(1:N)/N))/(sum(w)/N);
x=x.*w;
fx=fft(x)/N;
fp=(0:N/2)/N/dt;
fm=-fp(length(fp)-1:-1:2);
freq=[fp,fm];
plot(freq,abs(fx),'r')
