%% Linear Chirp
% Generate a chirp with linear instantaneous frequency deviation. The chirp is sampled at 1 kHz for 2 seconds. The instantaneous frequency is 0 at t = 0 and crosses 250 Hz at t = 1 second.

t = 0:1/1e3:2;
y = chirp(t,0,1,250);

%
% Compute and plot the spectrogram of the chirp. Divide the signal into segments such that the time resolution is 0.1 second. Specify 99% of overlap between adjoining segments and a spectral leakage of 0.85.

pspectrum(y,1e3,'spectrogram','TimeResolution',0.1, ...
    'OverlapPercent',99,'Leakage',0.85)

% Copyright 2015 The MathWorks, Inc.