File Exchange

## Short Time Fourier Transform (STFT)

version 1.3.0.0 (2 KB) by Hooman Sedghamiz

### Hooman Sedghamiz (view profile)

To visualize the STFT of a signal for further processing

Updated 06 Feb 2014

%% function [t,frequency,Power_spectrum]=fft_s(y,windowlength)
%% Inputs :
% y: input raw signal
% windowlength: window length to take fast fourier transform, it is a
% factor of smapling frequency for example one can enter a window length
% half of the sampling frequency by enteríng 0.5 and if fs =1000, then the
% window is 500 samples length
% reshaping: reshapes the signal to the length of the windowlength. if your
% signal is already chunked make it zeros otherwise it is should always be
% =1;
% gr : plot or not (0 plot, 1 no plot)

%% Example : [t,frequency,Power_spectrum]=fft_s(EMG,0.1,1000,1,1)
%% Outputs :
% t : time
% frequency : Frequency
% Power_spectrum : Power spectrum
%% Method:
% Chunks the signal with th elength of windowlength and gets the
% fast fourier transform and outputs a 3d plot
%% Tuning
% for a better resolution in time domain reduce the windowlength and for a
% better resolution in frequency domain increase the windowlength.
% Keep in mind that wavelet transform is in the most cases more effective and dont have
% the resolution problem in one domain

% Author : Hooman Sedghamiz (hoose792@student.liu.se)
%% Frequency analysis (FFT with plot)
% Fast Fourier Transform Windowed

### Cite As

Hooman Sedghamiz (2019). Short Time Fourier Transform (STFT) (https://www.mathworks.com/matlabcentral/fileexchange/45405-short-time-fourier-transform-stft), MATLAB Central File Exchange. Retrieved .

Leon Gunther

### Leon Gunther (view profile)

I am new to Matlab.
Could you instruct me as to how to enter a specific wave form into the code?
-- such as a set of sine waves or an FM wave, or a chirp or a sine wave AM modulated with a sine wave or a ramped amplitude a+bt?
Thank you so kindly;
Leon Gunther

Mohamed LE HAMEL

heehyeon kim

thanks a lot