?? stft0629.m
字號:
% exa110702_specgram.m ,for example 11.7.2 and fig11.7.1
% to test specgram.m
%-------------------------------------------------------------------------
%clear;
%t=0:0.001:1.024-.001;
%N=1024;
% 得到兩個Chirp 信號,并相加;
%y1=chirp(t,0,1,350);
%y2=chirp(t,350,1,0);
%y=y1+y2;
%subplot(211);plot(t,y1);
%ylabel(' Chirp signal y1')
% 求兩個Chirp 信號和的短時傅里葉變換;
%[S,F,T]=specgram(y,127,1,hanning(127),126);
%subplot(212);
%surf(T/1000,F,abs(S).^2)
%view(-80,30);
%shading flat;
%colormap(cool);
%xlabel('Time')
%ylabel('Frequency')
%zlabel('spectrogram')
load tf.dat;
pt=tf(:,1);pf=tf(:,2); %分離出時間和幅值信號
%subplot(311);
%plot(pt,pf);
title('Time Domain'); %繪制原時域信號圖
[S,F,T]=specgram(pf,64,1E3,hanning(64),0);
subplot(311);
surf(T/1000,F,abs(S).^2);
view(-80,30);
shading flat;
colormap(cool);
xlabel('Time');
ylabel('Frequency');
zlabel('spectrum');
[S,F,T]=specgram(pf,128,1E3,hamming(128),0);
subplot(312);
surf(T/1000,F,abs(S).^2);
view(-80,30);
shading flat;
colormap(cool);
xlabel('Time');
ylabel('Frequency');
zlabel('spectrum');
[S,F,T]=specgram(pf,256,1E3,hamming(256),0);
subplot(313);
surf(T/1000,F,abs(S).^2);
view(-80,30);
shading flat;
colormap(cool);
xlabel('Time');
ylabel('Frequency');
zlabel('spectrum');
%[y,f,t,p] = spectrogram(pf,256,250,F,1E3,'yaxis');
%subplot(313);
%surf(t,f,10*log10(abs(p)),'EdgeColor','none');
%axis xy; axis tight;colormap(jet);view(0,90);
%xlabel('Time');
%ylabel('Frequency(Hz)')
%t=0:0.001:2; % 2 secs @ 1kHz sample rate
%x=chirp(t,0,1,150); % Start @ DC, cross 150Hz at t=1sec
%F = 0:.1:100;
% [y,f,t,p] = spectrogram(x,256,250,F,1E3,'yaxis');
% NOTE: This is the same as calling SPECTROGRAM with no outputs.
%surf(t,f,10*log10(abs(p)),'EdgeColor','none');
%axis xy; axis tight; colormap(jet); view(0,90);
%xlabel('Time');
%ylabel('Frequency (Hz)')
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -