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

📄 stft_ft.m

📁 Another way to do a stft but with fft from matlab
💻 M
字号:
clear all;  %FUNCTION SHORT TIME FOURIER TRANSFORM(STFT) which takes 
            %the argument x1 as the input nonstationary signal 
            %here the signal is generated by matlab program
N1=50;      %the time interval for which the different frequencies exist%
m=1;
z=N1;
f=5;
for i=1:4   
n=m:z;
x1(m:z)=cos(2*pi*f*n/200);
m=z+1;
z=m+N1-1;
if i~=3
f=f*2;
else
    f=50;
end
end        %here is x1  the nonstationary signal produced%
for i=1:150
window(i)=i;
end             %here is the rectangualr window is generated which will be 
                %shifted 1 unit time resulting to a highly overlapping
                %window
for i=1:150
    for  k=1:50
        n=window(i):window(i)+49;
        e1=exp(-j*2*pi*n*(k-1)/N1);
        y(i,k)=abs(x1(window(i):window(i)+49)*e1');
                %the resultant amplitude will be stored in y array for
                %each window having the frequency varying with time%
    end
end
counter=1;
for i=1:150
    for k=1:50
        array(counter,1)=i;
        array(counter,2)=k;
        array(counter,3)=y(i,k);
        counter=counter+1;
    end     %for plotting the SHORT TIME FOURIER TRANSFORM(STFT) of the
            %nonstationary signal time,frequency,aplitude 3D plot
            %we keep the 3 coordinates value in a single array named array
            %the 3d plot is done and designed by the software table 3d
            %curve which gives the absolutely wanted result as it could
            %be got applying the same signal's FAST FOURIER TRANSFORM(FFT).
end
t=1:7500;
plot3(array(t,1),array(t,2),array(t,3));
xlabel('time');
ylabel('frequency');
zlabel('amplitude');

⌨️ 快捷键说明

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