You can use the Signal Analyzer app to perform several signal preprocessing tasks. The different processing options appear in the Analyzer tab:
Preprocessing operations, undo operations, and function generation apply to all signals currently selected in the Signal table. To select signals, click their Name, Info, Time, or Start Time column in the Signal table.
Preprocessing is not supported for labeled signal sets. If you want to preprocess a signal that belongs to a labeled signal set, you must first extract the signal from the set. See Extract Signal Regions of Interest for more information.
Preprocessing operations overwrite the signal on which they work. If you want to keep the original signal, duplicate it and operate on the duplicate.
You can perform preprocessing actions any number of times and in any order. The Info column in the Signal table includes an icon that indicates if any preprocessing has been performed on a signal. Clicking the icon enumerates the actions and the order in which they were performed. Preprocessing steps can be undone by clicking Undo Preprocessing on the Analyzer tab or on any tab arising from a preprocessing action. The steps are undone one at a time, starting with the most recent.
To see a full summary of the preprocessing steps you took, including all settings you chose, click Generate Function on the Analyzer tab.
You can preprocess individual channels of a multichannel signal. If you select a multichannel signal and one of its channels for preprocessing, the app preprocesses the individual channel only once.
Signal Analyzer enables you to duplicate and rename signals that you can then preprocess or export for further analysis.
To duplicate a signal, use the Duplicate button on the
Analyzer tab or on any tab arising from a preprocessing action.
Alternatively, right-click the signal in the Signal table and select
Duplicate. The duplicate has the same name as the original signal
If you select a signal and one of its channels for duplication, the app creates a duplicate of the signal and an independent duplicate of the selected channel.
To rename a signal, double-click the signal name in the Signal table and change the name. Alternatively, right-click the signal in the Signal table and select Rename.
You cannot rename individual channels of a multichannel signal.
To filter one or more selected signals, on the Analyzer tab, click
the Lowpass, Highpass,
Bandpass, or Bandstop icon in the
Preprocessing gallery. The app uses the
functions to perform the filtering. You can control the stopband attenuation, the passband
frequencies, and the widths of the transition regions. See the function reference pages for
additional information. Filtering does not support nonuniformly sampled signals.
To smooth one or more selected signals, on the Analyzer tab, click
the Smooth icon in the Preprocessing gallery. The
app uses the MATLAB® function
smoothdata to perform the smoothing. The
following smoothing methods are available:
Robust linear regression
Robust quadratic regression
To resample one or more selected signals, on the Analyzer tab,
expand the Preprocessing gallery and click the
Resample icon. Signal Analyzer uses the Signal Processing Toolbox™ function
resample to perform the resampling. The
following options are available:
When your signal is nonuniformly sampled, you can use the app to interpolate it onto a uniform grid. You can specify the interpolation method and the sample rate at which you want the signal to be sampled. The following interpolation methods are available:
Shape-preserving piecewise cubic interpolation
Cubic spline interpolation using not-a-knot end conditions
interp1 reference page for more
When your signal is uniformly sampled, you can use the app to change its sample rate. You can specify either the desired sample rate or the factor by which you want to upsample or downsample the signal. In this case, the interpolation panel in the Resample tab is disabled because the interpolation operation does not make sense with uniformly sampled signals.
The resampling operation requires time information. If you try to resample a signal in samples, the app issues a warning.
To detrend one or more selected signals, on the Analyzer tab,
expand the Preprocessing gallery and click the
Detrend icon. Signal Analyzer uses the MATLAB function
detrend to perform the detrending. The app
can remove the following trends from signals:
Piecewise linear trends. To remove a piecewise linear trend, specify the breakpoints as a comma-separated list.
To compute the envelope of one or more selected signals, on the
Analyzer tab, expand the Preprocessing gallery
and click the Envelope icon. Signal Analyzer uses the
Signal Processing Toolbox function
envelope to estimate envelopes. You can
compute the upper envelope or the lower envelope of each signal. The following envelope
estimation algorithms are available:
Hilbert — The app computes the signal envelope as
the magnitude of the analytic signal found using the discrete Fourier transform as
FIR — The app computes the signal envelope by
filtering the signal with a Hilbert FIR filter of adjustable size and using the
result as the imaginary part of the analytic signal.
RMS — The app computes the signal envelope by
connecting RMS values computed using a moving window of adjustable length.
Peak — The app computes the signal envelope by using
spline interpolation over local maxima separated by an adjustable number of
Envelope computation does not support complex signals.
To add a custom preprocessing function, on the Analyzer tab, click the arrow next to the Preprocessing gallery and then select Add Custom Function. The app prompts you to enter the function name and a brief description:
If you have already written a preprocessing function, and the function is in the current folder or in the MATLAB path, the app incorporates it to the gallery. You can use tab completion to search for the function name.
If you have not written the function yet, the app opens a blank template in the Editor.
Custom preprocessing functions have mandatory and optional arguments:
The first input argument,
x, is the input signal. This
argument must be a vector and is treated as a single channel.
The second input argument,
tIn, is a vector of time values.
The vector must have the same length as the signal. If the input signal has no
time information, the function reads this argument as an empty array.
varargin to specify additional
input arguments. If you do not have additional input arguments, you can omit
varargin. Enter the additional arguments as an ordered
comma-separated list in the Preprocess tab.
The first output argument,
y, is the preprocessed
The second output argument,
tOut, is a vector of output time
values. If the input signal has no time information,
returned as an empty array.
To implement your algorithm, you can use any MATLAB or Signal Processing Toolbox function.
See Declip Saturated Signals Using Your Own Function for more details.
Example: This function removes the DC value of a signal by subtracting its mean.
function [y,tOut] = removeDC(x,tIn) % Remove the DC value of a signal by subtracting its mean y = x - mean(x); tOut = tIn; end
Example: This function changes the starting time of a signal to a specified value.
function [y,tOut] = timealign(x,tIn,startTime) % Change the starting time of a signal y = x; t = tIn; if ~isempty(t) t = t - t(1) + startTime; end tOut = t; end
At any time, you can edit functions, edit their descriptions, or remove them, using the Manage Custom Functions option in the gallery.
Custom preprocessing functions must not change the complexity of the input signal.