%% Track Crossing Orders
% Create a simulated vibration signal consisting of two crossing orders corresponding to two different motors. The signal is sampled at 300 Hz for 3 seconds. The first motor increases its rotational speed from 10 to 100 revolutions per second (or, equivalently, from 600 to 6000 revolutions per minute) during the measurement. The second motor increases its rotational speed from 50 to 70 revolutions per second (or 3000 to 4200 revolutions per minute) during the same period.

fs = 300;
nsamp = 3*fs;

rpm1 = linspace(10,100,nsamp)'*60;
rpm2 = linspace(50,70,nsamp)'*60;

%
% The measured signal is of order 1.2 and amplitude 2√2 with respect to the first motor. With respect to the second motor, the signal is of order 0.8 and amplitude 4√2.

x = [2 4]*sqrt(2).*cos(2*pi*cumtrapz([1.2*rpm1 0.8*rpm2]/60)/fs);

%
% Make the first motor excite a resonance at the middle of the frequency range.

rs = [1+1./(1+linspace(-10,10,nsamp).^4)'/2 ones(nsamp,1)];

x = sum(rs.*x,2);

%
% Visualize the orders using rpmfreqmap.

rpmfreqmap(x,fs,rpm1)

%
% Compute the order magnitudes for both motors as a function of RPM. Use the Vold-Kalman algorithm to decouple the crossing orders.

ordertrack(x,fs,[rpm1 rpm2],[1.2 0.8],[1 2],'Decouple',true)

% Copyright 2012 The MathWorks, Inc.