| Interactive smoothing for your own data, with sliders to control smooth width and the number of passes of the smoothing function through the signal. Requires Matlab 6.5. To use it, place the signal to be smoothed in the global variables X,Y (X = independent variable, Y = dependent variable) and define MaxSmoothwidth as the maximum range of the smooth width slider. Then execute this m-file. Use the Smooth and Passes sliders to change the smooth width and number of passes interactively. The smoothed signal is left in global variable SmoothY. The actual smoothing is performed by the function SmoothSliderRedraw, which is called when the sliders are moved. You can change the smoothing function by replacing "fastsmooth" in line 8 of SmoothSliderRedraw with any other smoothing function. |
| A self-contained interactive demo of the effect of smoothing on peak height, width, and signal-to-noise ratio. Requires Matlab 6.5. Generates a Gaussian peak (peak height = 1.0, peak width = 200), adds random noise, smooths it, and measures the signal- to-noise ratio (SNR), peak height, and peak width of the smoothed data. Use the Smooth and Passes sliders to change the smooth width and number of passes interactively. The Resample slider applies different random noise samples, to demonstrate the low-frequency noise that remains. The smooth width and smooth ratio are displayed at the top, and the computed signal maximum, peak width, and signal-to-noise ratio (SNR) are displayed at the bottom of the graph. You can change the peak shape in line 26, and the peak height, width, and noise in lines 21-24. To change the smoothing function, replace "fastsmooth" in the function DemoSmoothRedraw with another smoothing function. |
function SmoothY=fastsmooth(Y,smoothwidth)
Smooths vector Y by triangular smooth of width =
smoothwidth.
Faster than convolution-based smooths for large smooth widths.
Tom O'Haver
Professor Emeritus
Department of Chemistry and Biochemistry
The University of Maryland at College Park
toh@umd.edu
http://www.wam.umd.edu/~toh