License

Copyright (c) 2017, Tom O'Haver
All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:

* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in
the documentation and/or other materials provided with the distribution

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.

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);

The isignaldemo fails to run. I have an undefined function 'gaussian' at line 37. As far I can tell from the MATLAB help, this is not a built in function in any of the toolboxes. What function are you using? And where did you get 'gaussian' so that I can try the demo?

Version 2.8 has an improved frequency Spectrum function that remains active when changing the smoothing, differentiation, and other functions, allowing you to see the effect on the frequency spectrum immediately. Press Shift-S again to return to the normal mode.

In version 2.0, the C key condenses oversampled signals by the specified factor N, replacing each group of N points with their average. The I key replaces the signal with a linearily interploated version containing a specified number of data points.