% spectrogram examples for ECE 802l %sinusoid; %logon; x=logon(64,0.4,128); tflog=specgram(x,32,128,32,31); subplot(211); plot(real(x)); subplot(212); imagesc(abs(tflog)); pause; figure %demo signal; tfdemo=specgram(demosig,32,200,32,31); imagesc(abs(tfdemo)); pause figure; % effect of the window length; y=[zeros(1,128),exp(j*0.6*[1:128])]; subplot(411); plot(real(y)); subplot(412); tf1=specgram(y,16,256,16,15); imagesc(abs(tf1)); subplot(413); tf2=specgram(y,32,256,32,31); imagesc(abs(tf2)); subplot(414); tf3=specgram(y,64,256,64,63); imagesc(abs(tf3)); t=0:0.001:2; % 2 secs @ 1kHz sample rate y=chirp(t,0,1,150); % Start @ DC, cross 150Hz at t=1sec tf1=specgram(y,256,1E3,256,250); t=-2:0.001:2; % +/-2 secs @ 1kHz sample rate y=chirp(t,100,1,200,'q'); % Start @ 100Hz, cross 200Hz at t=1sec tf2=specgram(y,128,1E3,128,120); % Display the spectrogram title('Quadractic Chip: start at 100Hz and cross 200Hz at t=1sec');