%-- %-- specgram demo idea %-- format compact keybd = 0; Fs = 8000 Fo = 660 T_total = 1.2; tt = 0:(1/Fs):T_total; %--- W = 1600; %-- Total Frequency Deviation Fch = 990; chch = dchirp(T_total,W, Fs/W).'; y1 = real( chch.*exp(2i*pi*Fch*tt(1:length(chch))) ); %======================================== Fc = 4; y1 = vco( sin(2*pi*Fc*tt), [400 700], Fs ); %-- figure(1), sound(y1,Fs) Fmax = Fs/4; Nfft = 128; Nover = 100; nn = 1:4:fix(length(y1)); [B,F,T] = specgram(y1(nn),Nfft,Fmax,[],Nover); subplot(2,2,1), imagesc(T,F,db(B,40)); title(['SINE WAVE MODULATED CHIRP']) axis xy, colormap(1-gray) ylabel('FREQUENCY (Hz)'), xlabel('TIME (sec)') drawnow, sound(y1,Fs) B1 = B; F1 = F; T1 = T; if( keybd ), keyboard, end %--- %======================================== Fc = 16; y2 = vco( sin(2*pi*Fc*tt), [400 700], Fs ); %-- figure(1), sound(y2,Fs) Fmax = Fs/4; Nfft = 128; Nover = 100; nn = 1:4:fix(length(y2)); [B,F,T] = specgram(y2(nn),Nfft,Fmax,[],Nover); subplot(2,2,2), imagesc(T,F,db(B,40)); title(['SINE WAVE MODULATED CHIRP']) axis xy, colormap(1-gray) ylabel('FREQUENCY (Hz)'), xlabel('TIME (sec)') drawnow, sound(y2,Fs) B32 = B; F2 = F; T2 = T; if( keybd ), keyboard, end %--- %======================================== Fc = 64; y3 = vco( sin(2*pi*Fc*tt), [400 700], Fs ); %-- figure(1), sound(y3,Fs) Fmax = Fs/4; Nfft = 128; Nover = 100; nn = 1:4:fix(length(y3)); [B,F,T] = specgram(y3(nn),Nfft,Fmax,[],Nover); subplot(2,2,3), imagesc(T,F,db(B,40)); title(['SINE WAVE MODULATED CHIRP']) axis xy, colormap(1-gray) ylabel('FREQUENCY (Hz)'), xlabel('TIME (sec)') drawnow, sound(y3,Fs) B3 = B; F3 = F; T3 = T; if( keybd ), keyboard, end %--- %======================================== Fc = 128; y4 = vco( sin(2*pi*Fc*tt), [400 700], Fs ); %-- figure(1), sound(y4,Fs) Fmax = Fs/4; Nfft = 128; Nover = 100; nn = 1:4:fix(length(y4)); [B,F,T] = specgram(y4(nn),Nfft,Fmax,[],Nover); subplot(2,2,4), imagesc(T,F,db(B,40)); title(['SINE WAVE MODULATED CHIRP']) axis xy, colormap(1-gray) ylabel('FREQUENCY (Hz)'), xlabel('TIME (sec)') drawnow, sound(y4,Fs) B4 = B; F4 = F; T4 = T;