%% Wigner-Ville Distribution of Chirps
% Generate a signal sampled at 1 kHz for 1 second. One component of the signal is a chirp that increases in frequency quadratically from 100 Hz to 400 Hz during the measurement. The other component of the signal is a chirp that decreases in frequency linearly from 350 Hz to 50 Hz in the same lapse.
% Store the signal in a timetable.

fs = 1000;
t = 0:1/fs:1;

x = chirp(t,100,1,400,'quadratic') + chirp(t,350,1,50);

%
% Compute the Wigner-Ville distribution of the signal.

wvd(x,fs)

%
% Compute the smoothed pseudo Wigner-Ville distribution of the signal. Specify 501 frequency points and 502 time points.

wvd(x,fs,'smoothedPseudo','NumFrequencyPoints',501,'NumTimePoints',502)

%
% Increase the number of time points so the quadratic chirp becomes visible.

wvd(x,fs,'smoothedPseudo','NumFrequencyPoints',501,'NumTimePoints',522)

%
% Increase the frequency points and time points to get a sharper image.

wvd(x,fs,'smoothedPseudo','NumFrequencyPoints',1000,'NumTimePoints',1502)

% Copyright 2018 The MathWorks, Inc.