isignal(datamatrix,xcenter,xrange,sm,sw,em,dm,rm,s1,s2,sr,mw,spm)
function function [pY,SpectrumOut]=isignal(DataMatrix,xcenter,xrange,sm,sw,em,dm,rm,s1,s2,sr,mw)
Version 6, December 2017. Adds segmented smooth (Press Shift-Q to set smooth width vector for segmented smooth); adds Shift-B to display before and after signals in figure window 2.
An interactive function that performs smoothing, differentiation, peak sharpening, and power spectrum analysis of a time-series signal, which may be a 2-column matrix with the independent variable (x-values) in the first column and dependent variable (y values) in the second column, or separate x and y vectors, or a single y-vector. Returns the processed independent axis (Y) vector as the output argument. The lower half of the figure window shows a plot of the entire signal, and the upper half shows a selected portion controlled by the pan and zoom keystrokes or by optional input arguments 'xcenter' and 'xrange', respectively. Other keystrokes also allow you to control the smooth type, width, and ends treatment, the derivative order (0th through 5th), and peak sharpening. (Alternatively, the initial values of these parameters can be passed to the function via the optional input arguments sm, sw, em, dm, rm, s1, s2, sr, and mw).
The S key (or optional argument "sm") determines the smooth mode:
If sm=0, the signal is not smoothed.
If sm=1, rectangular (sliding-average or boxcar)
If sm=2, triangular (2 passes of sliding-average)
If sm=3, pseudo-Gaussian (3 passes of sliding-average)
If sm=4, Savitzky-Golay smooth
The A and Z keys (or optional argument sw) control the smooth width.
The X key (or argument "em") controls how the "ends" of the signal (the first w/2 points and the last w/2 points) are handled.
If ends=0, the ends are zero.
If ends=1, the ends are smoothed with progressively smaller smooths the closer to the end.
See http://terpconnect.umd.edu/~toh/spectrum/Smoothing.html
The D key (or optional input argument "dm") determines the derivative
order (O, 1, 2, 3, 4, or 5). See
http://terpconnect.umd.edu/~toh/spectrum/Differentiation.html
The E key (or optional argument "rm") turns off and on peak
sharpening (resolution enhancement). The sharpening strength is
controled by the F and V keys (optional argument "s1") and B and G
keys (optional argument "s2"). The optimum values depend on the peak shape and width; For details, see http://terpconnect.umd.edu/~toh/spectrum/InteractiveResEnhance.htm).
The Backspace key starts background correction mode. The cursor changes to crosshairs; click it at multiple points along the presumed background. When the last point is clicked, the linearly interpolated baseline between those points is subtracted from the signal. To restore the original background (i.e. to correct an error or to try again), press the '\' key (just below the backspace key).
The P key toggles off and on the peak measure mode, which measures and displays the peak position, height, width, and area of the one peak at a time if it is centered and zoomed in; a red "cap" on the peak indicates that portion of the signal that is taken for the measurement. Press the 'R' key to print out the peak measures in the command window. Press the T key to activate the "autozero" mode, which subtracts a quadratic background from the signal segment in the upper window.
The L key toggles off and on the Overlay mode, which overlays the selected portion in the upper plot with the original signal as a dotted line, for comparison.
Press K to see all keyboard commands.
EXAMPLE 1: Data in two columns of a matrix.
>> load data.mat
>> isignal(DataMatrix);
EXAMPLE 2: Data in separate x and y vectors
>> isignal(x,y); or
>> isignal(y)
EXAMPLE 3: As above, but specifies initial values of pan (xcenter) and
zoom (xrange) in the last two input arguments.
>> isignal(DataMatrix,180,40); or
>> isignal(x,y,180,40);
EXAMPLE 4: As above, but additionally specifies initial values of
SmoothMode, SmoothWidth, ends, and DerivativeMode.
>> isignal(DataMatrix,180,40,2,9,0,1);
EXAMPLE 5: As above, but additionally specifies initial values of the
peak sharpening parameters Sharpen, Sharp1, and Sharp2.
>> isignal(DataMatrix,180,40,2,9,0,0,1,51,6000);
EXAMPLE 6: >> x=[0:.005:2];y=humps(x);Data=[x;y];
4th derivative of the peak at x=0.9:
>> isignal(Data,0.9,0.5,1,3,1,4);
Peak sharpening applied to the peak at x=0.3:
>> isignal(Data,0.3,0.5,1,3,1,0,1,220,5400);
(Press 'E' key to toggle sharpening ON/OFF)
Cite As
Tom O'Haver (2024). isignal(datamatrix,xcenter,xrange,sm,sw,em,dm,rm,s1,s2,sr,mw,spm) (https://www.mathworks.com/matlabcentral/fileexchange/32075-isignal-datamatrix-xcenter-xrange-sm-sw-em-dm-rm-s1-s2-sr-mw-spm), MATLAB Central File Exchange. Retrieved .
MATLAB Release Compatibility
Platform Compatibility
Windows macOS LinuxCategories
- Industries > Biotech and Pharmaceutical > QSP, PKPD, and Systems Biology >
- Signal Processing > Signal Processing Toolbox > Spectral Analysis > Spectral Measurements >
Tags
Acknowledgements
Inspired by: Savitzky-Golay smooth/differentiation filters and filter application
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!Discover Live Editor
Create scripts with code, output, and formatted text in a single executable document.
Version | Published | Release Notes | |
---|---|---|---|
6.1.0.0 | You can specify the segmented smoothwidth vector in two ways, either directly or as number of segments and first and last values. |
||
6.0.0.0 | Version 6, December 2017. Adds segmented smooth (Press Shift-Q to set smooth width vector for segmented smooth); adds Shift-B to display before and after signals in figure window 2. |
||
5.7.0.0 | bug fix
|
||
5.5.0.0 | Version 5.5, April, 2016, adds Shift-T command to replace signal with its frequency spectrum; adds measurement of full width at half maximum (FWHM) . |
||
4.4.0.0 | Version 4.4 has several small additions and corrections. |
||
1.33.0.0 | Version 4 adds Shift-o to perform pOlynomial least-squares of the selected segment. |
||
1.32.0.0 | Version 3.4: In spectrum mode, Shift-Z toggles on and off frequency/time
|
||
1.31.0.0 | Version 3. Adds Shift-W, display Waterfall spectrum in Figure 2. |
||
1.30.0.0 | Version 2.95, March, 2014. Adds ability to save frequency spectrum as a variable. |
||
1.29.0.0 | Corrects "missing function" error in isignaldemo.m |
||
1.28.0.0 | Version 2.9: Includes version 4.2 of peakfit.m, which adds a Voigt profile peak shape and flat baseline mode for iterative least-squares fits. |
||
1.27.0.0 | Version 2.8: Improved frequency Spectrum function |
||
1.26.0.0 | Version 2.7: Added peakfit function (Shift-F); Added frequency Spectrum function (Shift-S) |
||
1.25.0.0 | Adds slew rate limit (~ key) and spike filter (M key). Measures peak area two ways. Fixes several bugs related to input arguments. Computes signal-to-noise ratio (SNR) in Peak mode. |
||
1.24.0.0 | Version 2.1: Added slew rate limit (~ key) and median filter (M key) to reduce spikes. |
||
1.23.0.0 | Version 2.0: adds C key (condense signal), I key (interpolate signal); O key now saves processed signal to disc as a matrix in a .mat file. |
||
1.22.0.0 | Version 1.95: Bug fixes in backgrouond correction and peak measurememnt modes. |
||
1.21.0.0 | Version 1.9: Derivatives computed with respect to x, corrected for non-uniform x axis intervals. Minor bug fixes and display improvements. |
||
1.20.0.0 | Bug fix |
||
1.19.0.0 | Added Savitzky-Golay smooth (thanks to Diederick) |
||
1.18.0.0 | Version 1.7 adds a quadratic background subtraction mode, other small additions and bug fixes. |
||
1.15.0.0 | Corrected error in description |
||
1.14.0.0 | Version 1.6 can accept single vector inputs as well as matrix and x,y and adds semilog plot mode for overall signal (press H key). |
||
1.13.0.0 | Version 1.4 adds area to signal info (Q); green center cursor, bug fixes. |
||
1.12.0.0 | Version 1.2 adds several new functions. |
||
1.0.0.0 |