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

    %% 3D Spectrogram Visualization
% Generate two seconds of a signal sampled at 10 kHz. Specify the
% instantaneous frequency of the signal as a triangular function of time.

% Copyright 2015 The MathWorks, Inc.


%%

fs = 10e3;
t = 0:1/fs:2;
x1 = vco(sawtooth(2*pi*t,0.5),[0.1 0.4]*fs,fs);

%%
% Compute and plot the spectrogram of the signal. Use a Kaiser window of
% length 256 and shape parameter $\beta=5$. Specify 220 samples of
% section-to-section overlap and 512 DFT points. Plot the frequency on the
% _y_-axis. Use the default colormap and view.

spectrogram(x1,kaiser(256,5),220,512,fs,'yaxis')

%%
% Change the view to display the spectrogram as a waterfall plot. Set the
% colormap to |bone|.

colormap bone
view(-45,65)