image thumbnail
from evaluating SHORT TIME FOURIER TRANSFORM of a stationary signal by payel mukherjee
the STFT of a nonstationary signal taking highly overlapping rectangular window.

stft_ft.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');

Contact us at files@mathworks.com