%% WINDOWSINE_DEMO3 %% %% This Matlab m-file demonstrates what happens in DFT analysis as %% fix the two sinusoidal frequencies to be 5 and 5.5 Hz, fix the DFT %% length to 8192, and vary the window length from 100 to 1000 in %% increments of 25. %% %------------------------------------------------------------------- clf; %------------------------------------------------------------------- %%% Parameters f1=5; f2=5.5; fs=100; Tinterv=10; phi=[0 0]; [x,t]=sum_sine([f1 f2],Tinterv,fs,phi); win_type='boxcar'; dft_length=8192; for win_length=100:25:1000 ind=1:win_length; window=feval(win_type,win_length)'; v=x(ind).*window; [Vk,fk]=fr_resp(v,dft_length,fs); subplot(311) plot(t(ind),v) axis([min(t(ind)) max(t(ind)) min(v) max(v)]) xlabel('Time (seconds)') ylabel('v(t)'); title('Windowed sinusoid') fixfont(14,14,14) subplot(212) plot(fk,10*log10(abs(Vk))) axis([-10 10 -30 30]) xlabel('Frequency (Hz)'); ylabel('10log_{10}|V[k]|') tstr=sprintf('Frequencies: %0.1f and %0.1f Hz Window length: %i',... f1,f2,win_length); title(tstr); fixfont(14,14,14) disp('Hit return to continue') pause end