You can use the Signal Analyzer app to perform signal preprocessing tasks and editing actions. The different preprocessing options appear in the Analyzer tab. Preprocessing operations, undo operations, edit actions, 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. For more information, see Extract Signal Regions of Interest.
Preprocessing operations overwrite the signal on which they work. If you want to keep the original signal, duplicate it and operate on the duplicate.
The edit actions appear in the signal editing mode. To enter the mode, in the Analyzer tab, click the Edit Signal button. In this mode, you can clip, crop, and trim signals you selected before entering the mode.
You can perform preprocessing and editing actions any number of times and in any order. The Info column in the Signal table includes an icon that indicates if any preprocessing or editing 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. Editing steps can be undone by clicking undo on the quick access toolbar when you are in the signal editing mode or by clicking Undo Preprocessing on the Analyzer tab. The app undoes the steps 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.
Duplicate and Rename Signals
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.
In the signal editing mode, you can trim, clip, or crop one or more selected signals using the corresponding buttons in the Edit tab.
To perform a trim or clip action, draw a crosshair on the plot at the location where you want to remove data. Trim actions delete data from the start of the signal to the vertical cursor, or from the vertical cursor to the end of the signal. Clip actions delete data above or below the horizontal cursor threshold.
To perform a crop action, draw a region of interest (ROI) on the plot. Crop actions delete data outside the ROI limits.
You can use the spectrum, spectrogram, or scalogram view to aid in signal editing. You can also specify time limits manually for the crosshair or ROI. To save your editing, click Accept All. To discard your editing, click Cancel.
If a signal has time information, you can select Preserve Start Time in the Edit tab. This option sets the start time of the edited signal(s) to the position of the cursor when you perform the edit action.
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
available smoothing methods are:
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
available options are:
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
interp1reference page for more information.
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 these trends from signals:
Piecewise linear trends. To remove a piecewise linear trend, specify the breakpoints as a comma-separated list.
To denoise one or more selected signals, on the Analyzer tab,
expand the Preprocessing gallery and click the
Denoise icon. Signal Analyzer uses the
wdenoise (Wavelet Toolbox)
function to perform signal denoising with these parameters:
For an example, see Denoise Noisy Doppler Signal. You must have a Wavelet Toolbox™ license to denoise signals in the app.
Compute Signal Envelopes
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 available envelope
estimation algorithms are:
Hilbert— The app computes the signal envelope as the magnitude of the analytic signal found using the discrete Fourier transform as implemented in
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 samples.
Envelope computation does not support complex signals.
Add Custom Preprocessing Functions
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.
vararginto 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 signal.
The second output argument,
tOut, is a vector of output time values. If the input signal has no time information,
tOutis returned as an empty array.
If an input argument is finite, the output argument must be finite. If an input argument is non-finite, the output argument can be either finite or non-finite.
To implement your algorithm, you can use any MATLAB or Signal Processing Toolbox function.
For more details, see Declip Saturated Signals Using Your Own Function.
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.