⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 stft.m

📁 基于matlab的短时傅立叶变换
💻 M
字号:
clear;
clc;
[Y,FS,NBITS,OPTS] = wavread('背景小噪声.wav');
X = Y(1:264565);
L = length(X);
N = round(FS * 0.025); %窗口大小为25ms
LL = floor(L/N);%帧数
subplot(4,1,1);
plot(X);
title('飞船录音指令');
grid;
fs=4096;
x=zeros(1,L);
t=0:L-1;
x=fft(X);
x=fftshift(x);
subplot(4,1,2);
plot((t-L/2)*fs/L,abs(x));
Nw=20;
l=Nw/2;
Tn=(L-Nw)/l+1;      %39
nfft=32;
TF=zeros(Tn,nfft);
for i=1:Tn
b=hamming(2l);
xw=x((i-1)*l+1:i*l+l).*b';
temp=fft(xw,nfft);
temp=fftshift(temp);
TF(i,:)=temp;
end
subplot(4,1,3);
fnew=((1:nfft)-nfft/2)*fs/nfft;
tnew=(1:Tn)*l*Ts;
[F,T]=meshgrid(fnew,tnew);
mesh(F,T,abs(TF));
subplot(4,1,4);
contour(F,T,abs(TF));

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -