📄 test0806stft3.m
字号:
%---------------------------------------------------------------------------------------
% test0806stft3.m, for example 08.06
% two sinus signal and its STFT
% 2006.12.18 LYB
%----------------------------------------------------------------------------------------
clear;
n=256;
%------------------------
% example1:two sinus signal
w=pi/4; %f=1,fs=32
t=1:n;w1=t*w; part=n/2;
for k=1:part; sig(k)=sin(k*w); end;
for k=(part+1):2*part, sig(k)=sin(2*k*w); end;
sig=sig';
p=8;
for ni=1:p
N=2^ni-1;
h=ones(N,1);
%h=hanning(N);
%tfrstft(sig,1:128,128,h);
[TFR,T,F]=tfrstft(sig,1:n,n,h);
%figure(4);
subplot(3,p/2,ni+4);
imagesc(T,F,abs(TFR(1:n/2,1:n)).^2);
title(['N=',num2str(N)]);
hidden off;
clear TFR;
end;
ftreal=abs(fft(sig));
subplot(3,2,1);
plot(1:n,real(sig(1:n)));
axis([0 n-1 -1.2 1.2]);
title(' the signal x(t)');
subplot(3,2,2);
plot(1:n/2,ftreal(1:n/2));
axis([0 127 0 80]);
title(' the spectrum of x(t)');
%tfrreal=abs(TFR);
%figure(3);
%subplot(211);
%plot(ftreal);
%subplot(212);
%plot(tfrreal(1:127,1))
%imagesc(abs(TFR).^2);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -