[TFR,T,F]=TFRSTFT(X,T,N,H,TRACE)
X : 信号.
T : 时间序列 (默认值 :1:length(X)).
N : 频率点数 (默认值: length(X)).
H : 选择的平滑窗函数 (默认值: Hamming(N/4)).
TRACE : 如果不为零,跟踪计算过程 (默认为 : 0).
TFR : 得到的时频谱值(复数)
F : 归一化频率(-0.5 — +0.5),实际频率FF=fs*F;
clc
clear all
fs=1024;
N=2048;
t1=(0:N-1)/fs
T=(0:N/2-1)/fs
a=sin(2*pi*5*t1);
subplot(311)
plot(t1,a);
[tfr,t,f] = tfrstft(a');%a只能有一列
freq=(0:N/2)*fs/N;
subplot(312)
plot(freq,abs(tfr(1:N/2+1)));
k=fft(a)
subplot(313)
plot(freq,abs(k(1:N/2+1)));