www.gusucode.com > signal 案例源码程序 matlab代码 > signal/SynchrosqueezedFourierTransformOfSinusoidExample.m

    %% Fourier Synchrosqueezed Transform of Sinusoidal Signal
% Generate  1024 samples of a signal that consists of a sum of sinusoids
% embedded in white Gaussian noise. The normalized frequencies of the
% sinusoids are  $2\pi/5$ rad/sample and $4\pi/5$ rad/sample. The higher
% frequency sinusoid has 3 times the amplitude of the other sinusoid.

%%

N = 1024;
n = 0:N-1;

w0 = 2*pi/5;
x = sin(w0*n)+3*sin(2*w0*n);

%%
% Compute the Fourier synchrosqueezed transform of the signal. Plot the
% result.

[s,w,n] = fsst(x);

mesh(n,w/pi,abs(s))

axis tight
view(2)
colorbar

%%
% Compute the conventional short-time Fourier transform of the signal for
% comparison. Use the default values of |spectrogram|. Plot the result.

[s,w,n] = spectrogram(x);
 
surf(n,w/pi,abs(s),'EdgeColor','none')

axis tight
view(2)
colorbar