%% Visualize the Difference Signal and Amplitude Spectrum of a TSA Signal
% In this example, sineWaveRectangularPulse.mat contains the data of a sine wave modulated by a rectangular pulse. X is a vector with the 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 difference signal of the modulated TSA signal X. To obtain the difference signal, filter out the unmodulated sine wave and the sidebands of the modulation signal by specifying the frequency of 32 Hz in orderList. Set the value of 'Domain' to 'frequency'.

load('sineWaveRectangularPulse.mat','X','t','rpm','orderList')
tsadifference(X,t,rpm,orderList,'Domain','frequency');

% From the plot, observe the waveform and amplitude spectrum of the difference and raw signals, respectively. Observe that the difference signal contains everything except:
% Unmodulated sine wave at 32 Hz
% First-order sidebands of the unmodulated sine wave at 31 Hz and 33 Hz, respectively
% Copyright 2018 The MathWorks, Inc.
%
%