%% Hilbert Spectrum of Quadratic Chirp
% Generate a Gaussian-modulated quadratic chirp. Specify a sample rate of 2 kHz and a signal duration of 2 seconds.

fs = 2000;
t = 0:1/fs:2-1/fs;
q = chirp(t-2,4,1/2,6,'quadratic',100,'convex').*exp(-4*(t-1).^2);
plot(t,q)

%
% Use emd to visualize the intrinsic mode functions (IMFs) and the residual.

emd(q)

% Compute the IMFs of the signal. Use the 'Display' name-value pair to output a table showing the number of sifting iterations, the relative tolerance, and the sifting stop criterion for each IMF.

imf = emd(q,'Display',1);

%
% Use the computed IMFs to plot the Hilbert spectrum of the quadratic chirp. Restrict the frequency range from 0 Hz to 20 Hz.

hht(imf,fs,'FrequencyLimits',[0 20])

% Copyright 2019 The MathWorks, Inc.