%% Visualize the Residual and Amplitude Spectrum of a TSA Signal
% In this example, sineWaveAmpMod.mat contains the data of an amplitude modulated sine wave. X is a vector with the amplitude modulated sine wave data obtained at a shaft speed of 60 RPM. The unmodulated sine wave has a frequency of 32 Hz and amplitude of 1.0 units.
% Load the data, and plot the residual signal of the amplitude modulated TSA signal X. To obtain the residual signal, filter out the unmodulated sine wave by specifying the frequency of 32 Hz in orderList. Set the value of 'Domain' to 'frequency'.

load('sineWaveAmpMod.mat','X','t','rpm','orderList')
tsaresidual(X,t,rpm,orderList,'Domain','frequency');

% From the plot, observe the waveform and amplitude spectrum of the residual and raw signals, respectively.
% Copyright 2018 The MathWorks, Inc.