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

    %% Waterfall Plot of Frequency-RPM Map
% Generate a signal that consists of two linear chirps and a quadratic
% chirp, all sampled at 600 Hz for 15 seconds. The system that produces the
% signal increases its rotational speed from 10 to 40 revolutions per
% second during the testing period.

% Copyright 2015 The MathWorks, Inc.


%%
% Generate the tachometer readings.

fs = 600;
t1 = 15;
t = 0:1/fs:t1;

f0 = 10;
f1 = 40;
rpm = 60*linspace(f0,f1,length(t));

%%
% The linear chirps have orders 1 and 2.5. The component with order 1 has
% half the amplitude of the other. The quadratic chirp starts at order 6
% and returns to this order at the end of the measurement. Its amplitude is
% 0.8. Create the signal using this information.

o1 = 1;
o2 = 2.5;
o6 = 6;

x = 0.5*chirp(t,o1*f0,t1,o1*f1)+chirp(t,o2*f0,t1,o2*f1) + ...
    0.8*chirp(t,o6*f0,t1,o6*f1,'quadratic');

%%
% Compute the frequency-RPM map of the signal. Use the peak amplitude at
% each measurement cell. Specify a resolution of 6 Hz. Window the data
% with a flat top window.

[map,fr,rp] = rpmfreqmap(x,fs,rpm,6, ...
    'Amplitude','peak','Window','flattopwin');

%%
% Draw the frequency-RPM map as a waterfall plot.

[FR,RP] = meshgrid(fr,rp);
waterfall(FR,RP,map')

view(-6,60)
xlabel('Frequency (Hz)')
ylabel('RPM')
zlabel('Amplitude')