[Introduction]  [Signal arithmetic]  [Signals and noise]   [Smoothing]   [Differentiation]  [Peak Sharpening]  [Harmonic analysis]   [Fourier convolution]  [Fourier deconvolution]  [Fourier filter]   [Peak area measurement]  [Linear Least Squares]  [Multicomponent Spectroscopy]  [Iterative Curve Fitting]  [Hyperlinear quantitative absorption spectrophotometry] [Appendix and Case Studies]  [Peak Finding and Measurement]  [iPeak]   [iSignal]  [Peak Fitters]   [iFilter]  [iPower]  [List of downloadable software]  [Interactive tools]

index previous next

Interactive Signal Processing Tools

Free downloadable Matlab functions

for scientists, engineers, researchers, instructors, and students working in academia, industry, environmental, medical, engineering, earth science, space, military, financial, agriculture, and communications.

Last updated February, 2017

A retirement project
and international community service, by
Tom O'Haver, Professor Emeritus, Department of Chemistry and Biochemistry, University of Maryland at College Park.

Have a question? E-mail: toh@umd.edu or join our group on Facebook

What does Google rate as the most highly praised science software? Try this search.

This page describes a series of downloadable Matlab interactive signal processing tools for x,y time-series data. Technical background, documentation, and examples of application are provided in "A Pragmatic Introduction to Signal Processing", available in HTML and PDF formats.

The interactive functions listed on this page run in the Figure window and use a simple set of single keystroke commands, rather than on-screen buttons or menus or sliders, in order to reduce screen clutter, minimize overhead, and maximize processing speed. Press K to see the list of keystroke commands within each program. The Figure window can be re-sized as you wish, including maximized to full-screen or stretched over a two-screen setup to see the maximum detail in the signals, and can be Saved in various formats, Copy/Pasted, or Printed, using the standard Matlab menus. My goal is to make these programs very easy to get working, with flexible input syntax, built-in help, extensive online documentation, and many simple examples that you can copy and paste into your Matlab command window. Note: all of the functions described below are written as self-contained Matlab functions (m-files) and require no add-on toolboxes to run, but the scripts often call functions that must be downloaded and placed in the Matlab path. They have been developed and tested in Matlab 7.8 R2009a and in Matlab 8.1 R2013a and have bee used my many people using more recent version of Matlab.

A complete catalog of over 200 of my signal processing functions and demonstration scripts, both interactive and command-driven, are on functions.html. These scripts and functions are downloaded 500-1000 times per month on average and have been used by thousands of scientists, engineers, researchers, instructors, and students working in industry, environmental, medical, engineering, earth science, space, military, financial, agriculture, communications, and even music and linguistics. They have been applied in many areas of investigation and have been cited in over 160 published papers, theses, and patents. Don't miss the amazing unsolicited user comments below from actual users of these programs. User comments and suggestions have often resulted in changes and new features being added to the latest versions (see Matlab File Exchange "Pick of the Week"); keep those emails and messages coming.

First time here? Check out these animated Web demos of ipeak.m and ipf.m. Or download these Matlab demo functions that compare ipeak.m with peakfit.m for signals with a few peaks and signals with many peaks and that shows how to adjust ipeak to detect broad or narrow peaks. These are self-contained demos that include all required Matlab functions. Just place them in your path and click Run or type their name at the command prompt. Or you can download all these demos together in idemos.zip. Note: Make sure you don't click on the “Show Plot Tools” button in the toolbar above the figure; that will disable normal program functioning. If you do; close the Figure window and start again.

Author's appreciation: I wish to express my thanks and appreciation for all those who have made useful suggestions, corrected errors, and who have sent me data from their work to test my programs on.  These contributions have really helped to correct bugs and to expand the capabilities of my programs.

Peak Finding and Measurement  

Matlab routines for locating and measuring the peaks (or valleys) in noisy time-series data sets. It detects peaks by looking for downward zero-crossings (or upward zero-crossings for valleys) in the smoothed first derivative then determines the position, height, and width of each peak by least-squares curve-fitting of the raw data near the detected peaks. (This is useful primarily for signals that have several data points in each peak, not for spikes that have only one or two points).

There are both command-line and interactive versions:
(1) a set of command-line functions for Matlab and Octave, for finding peaks in signals and measuring their positions, heights, widths, and areas by least-squares curve-fitting, especially useful as modules to use in your own custom scripts and functions to automate data processing. These are listed here, each linked to its description: findpeaksx, findpeaksG, findvalleys, findpeaksL, measurepeaks, findpeaksG2d, findpeaksb, findpeaksb3, findpeaksplot, findpeaksplotL, peakstats, findpeaksE, findpeaksGSS, findpeaksLSS, findpeaksT, findpeaksfit, autofindpeaks and autopeaks. These can be used as components in creating your own custom scripts and functions. Don't confuse with the "findpeaks" function in the Signal Processing Toolbox. 

(2) a Matlab-only interactive keypress-operated function iPeak, illustrated on the right displaying signals from a variety of sources. Using iPeak, you can pan and zoom, adjust each of the peak detection parameters individually and interactively to optimize peak detection and measurement, and much more. For Matlab only. There is an animated demonstration.  

These tools are the ones to use when (a) the quantities of greatest interest are the peak positions and amplitudes of the positive peaks in your signal, (b) the peaks have distinct (even if noisy) maxima, and (c) when you want all the peaks numbered and quantified in one operation. You can use the interactive iPeak function to determine the ideal input arguments for the various findpeaks command-line functions. Note: the latest version of  iPeak can perform iterative non-linear curve fitting on the peaks that it finds, using the built-in peakfit.m function (described below); this is useful for highly overlapped or non-Gaussian peaks. For some demos, download idemos.zip.



iSignal: Interactive Smoothing, Derivative, and Signal Analysis

iSignal is a Matlab function, written as a single self-contained m-file, for performing. The latest version has these features:
(a) smoothing, sliding average, triangular Gaussian, Savitsky-Golay,
(b) differentiation, orders 1-5,
(c) peak sharpening (resolution enhancement),
(d) frequency spectrum, and periodigram,
(e) iterative least-squares peak fitting,
(f) baseline subtraction,
(g) peak and valley measurement,
(h) polynomial curve fitting,
(i) median filter,
(j) peak-to-peak and RMS noise measurement,
(k) linear interpolation,
(l) automatic peak detection and measurement.

Using simple keystrokes, you can adjust the signal processing parameters continuously while observing the effect on your signal dynamically.  Click here to download the ZIP file "iSignal5.zip" that also includes some sample data for testing. You can also download it from the Matlab File Exchange

This is the tool to use when you want to explore and clean up your signals and to try smoothing, differentiation, and peak sharpening. It measures things like peak-to-peak signal amplitude, standard deviation, frequency spectra, and the area under the curve of selected portions of your signal. It's also good for measuring peak positions, heights, areas (either one peak at a time or automatically) and for determining how smoothing, differentiation, and peak sharpening effect the signal and its frequency spectrum. It can also pre-process signals to re-sample them by interpolation, and reduce or remove artifacts such as spikes (with the median filter) and steps (with a rate-limiting filter). 

Interactive smoothing and differentiation

Frequency spectrum mode

Peak Fitters 

Peak fitting programs for time-series signals, which use a non-linear optimization algorithm to decompose a complex overlapping-peak signal into its component parts. The objective is to determine whether your signal can be represented as the sum of fundamental underlying peaks shapes. Accepts signals of any length, including those with non-integer and non-uniform x-values. Fits groups of peaks of many different shapes). There two different versions:

(1) peakfit.m, a command line versionfor Matlab and Octave, that fits a predetermined number of peaks, and findpeaksb.m and related functions  that uses findpeaks.m to locate peaks as input for the peakfit.m function (Octave users must install the "optim_1.2.2" package). This function is updated often, mostly to add new peak shape functions suggested by users. A Matlab File Exchange "Pick of the Week".
(2) Interactive Peak Fitter, ipf.m, a keypress-operated interactive version, for Matlab, that allows you to pan and zoom through the signal to pick the groups of peaks to fit. Does not work in Octave. There is an animated demonstration. Using ipf.m in Matlab, you can press a single keystroke to instantly adjust the data range, change the peak shape, number of peaks, baseline mode, or to re-calculate the fit with different start or with a bootstrap subset of the data. Super quick and easy.

The difference between them is that peakfit.m is completely controlled by command-line input arguments and returns its information via command-line output arguments; ipf.m allows interactive control via keypress commands. Otherwise they have the same curve-fitting capabilities. You can also download a ZIP file containing peakfit.m, DemoPeakFit.m, ipf.m, Demoipf.m, some sample data for testing, and a test script (testpeakfit.m) that runs all the examples sequentially to test for proper operation. 

These tools are the ones to use when (a) you need to measure the peak positions, amplitudes, widths, and areas of the positive peaks in your signal, (b) the peaks are highly overlapped, (c) you want specific peaks in your signal quantified, and (d) your peaks are approximately Gaussian, Lorentzian, Pearson, Logistic, or exponentially-  broadened Gaussian. You can use the interactive ifp.m function to determine the ideal input arguments for the peakfit.m and command-line function. Note: iterative non-linear curve fitting can also performed by the latest version of the interactive peak finder described above (iPeak). For some demos comparing peakfit.m to iPeak.m, download idemos.zip.

iFilter: Interactive Fourier Filter

iFilter is a Matlab implementation of a Fourier filter function for time-series signals, including interactive versions that allow you to adjust the filter parameters continuously while observing the effect on your signal dynamically. By adjusting the parameters, you can create lowpass, highpass, bandpass, and band-reject
(notch), comb pass, and comb reject filters with variable, frequency, width, and cut-off rate. . The x-axis is labeled for time-based signals, where the independent variable is time in seconds, but the program can be used with any frequency axis (e.g. spacial frequency, etc).  Click here to view or download iFilter.m  You can also download it from the Matlab File Exchange. Version 4.1, December, 2014.

This is the tool to use when you want to explore the frequency components of your signals and to design a custom filter that will optimize your signals.

Hyperlinear quantitative absorption spectroscopy

Matlab implementation of a computational method for quantitative analysis by multiwavelength absorption spectroscopy, called the transmission-fitting or “TFit” method, based on measuring the underlying absorbance by fitting a model of the instrumentally-broadened transmission spectrum to the observed transmission data, rather than by direct calculation of absorbance as simply log10(Izero/I). 

Advantages of the TFit method compared to conventional methods are: (a) wider dynamic range; (b) greatly improved calibration linearity; (c) ability to operate under conditions that are optimized for signal-to-noise ratio ratio rather than for optical ideality. With a linear response, absorbance can be converted to concentration simply by multiplying by a constant factor.

Just like the multilinear regression (classical least squares) methods conventionally used in absorption spectroscopy, the Tfit method (a) requires an accurate reference spectrum of each analyte, (b) utilizes multiwavelength data such as would be acquired on diode-array, Fourier transform, or automated scanning spectrometers, and (c) applies both to single-component and multi-component mixture analysis.

tfit.m is a command-line demo function for Matlab or Octave. TFitDemo.m is an interactive demo m-file that works in recent versions of Matlab. Version 2.1, November 2011.

iPower: Interactive Power Spectrum Demo

Matlab keyboard-controlled interactive power spectrum demonstrator, useful for teaching and learning about the power spectra of different types of signals and the effect of signal duration and sampling rate. Single keystrokes allow you to select the type of signal (12 different preset signals included), the total duration of the signal, the sampling rate, and the global variables f1 and f2 which are used in different ways in the different signals. If you know some basic Matlab programming, you can even add your own custom signal functions to this program. When the Enter key is pressed, the signal (y) is sent to the Windows WAVE audio device. Press K to see a list of all the keyboard commands. Tested in Matlab version 7.8 (R2009a).

Click here to view or download.  You can also download it from the Matlab File Exchange. Version 2, October 2011

Diffraction Grating Demos

A set of keyboard-controlled interactive demonstration modules, written as self-contained Matlab functions, that are useful for learning and teaching the principles of diffraction gratings. Shows a working cross section of the geometry of a diffraction grating (a common illustration in textbooks of optics, spectroscopy, and analytical chemistry). Single keystrokes allow you to control such variables as the angle of incidence, grating ruling density, wavelength, and diffraction order. One module shows how the operation of a diffraction grating emerges naturally just by adding up a bunch of sine waves, without any higher math at all. 

Press K to see a list of all the keyboard commands. Tested in Matlab version 7.8 (R2009a).

Click here to download ZIP file.  You can also download it from the Matlab File Exchange. Version 2, November 2011.

There is also a set of spreadsheets in Excel (.xls) and OpenOffice (.ods) format that illustrate grating operation in an interactive way, with sliders and number wheels to change parameters. 

Notes concerning the interactive functions ipeak.m, isignal.m, and ipf.m:
(a) Make sure you don't click on the “Show Plot Tools” button in the toolbar above the figure; that will disable normal program functioning. If you do; close the Figure window and start again.

(b) To facilitate transfer of settings from one of these functions to another or to a command-line version,all these functions use the W key to print out the syntax of other related functions, with the pan and zoom settings and other numerical input arguments specified, ready for you to Copy, Paste and edit into your own scripts or back into the command window. For example, you can convert an curve fit from ipf.m into the command-line peakfit.m function; or you can convert a peak finding operation from ipeak.m into the command-line findpeaksG.m or findpeaksb.m or findpeaksb3.m functions.

(c) Recent versions of these three programs use the Shift-Ctrl-S, Shift-Ctrl-F, and Shift-Ctrl-P keys to transfer the current signal between iSignal.m, ipf.m, and iPeak.m

Background information on these and other signal processing methods is available in:

A Pragmatic Introduction to Signal Processing

An illustrated essay available in Web, OpenOffice, Word , and PDF  format

Verbatim Unsolicited Comments from Users

" Your program iPeak is like falling out of a tree and landing in a soft couch complete with a book and a good reading light!

"Your peakfit script is simply phenomenal!"

"Fantastic Matlab code"

"...awesome functions!"

"...after days of trying and failing...I stumbled upon your site and was able to solve my problem in half an hour."

"... surely the way into heaven is to post excellent software online for others to use to do science."

"This makes me so incredibly happy!"

"...[ipf.m] is a really useful bit of code"

"...your wonderful [peak fitter] program. I use it on a regular basis...."

"peakfit is amazing!'

"I have been using iPeak ... (awesome program!!)."

"Interactive Peak Fitter [ipf.m]...worked very well. In a word, it's perfect!" 

"...iSignal 3...is a great tool!!"

"Your code is quite amazing."

"I’ve just download your very nice PeakFitter. It’s WONDERFUL!"

"You have great detailed instructions!"

"your excel sheet for spectral deconvolution ... worked beautifully."

"...how awesome your peakfitter is!"

"...you can't imagine how MUCH we'll use this."

"...thank you for taking the time to create these incredible tools."

"...your scripts findpeaks.m and ipeaks.m ... [are] super useful"

" ...the scripts that you developed which are a very useful help for a lot of people in science research."

"I got some really good results using Ipeak.

"This program [Peak Fitter] is perfect."

"I find these routines and the information on your website immensely valuable."

"I recently found your website and I’m really impressed, great work! "

"I have been using your "findpeaks" routine (matlab version) and it is working superbly."

"Your peak picking algorithm is very helpful to me."

"As far as I am concerned your code is perfect..."

"Your peakfit function is very powerful. I had test many data with success."

"I'm impressed at the convenience of your Peak Fitter and Interactive Peak Fitter programs."

"I found your Peak Fitter program to be incredibly useful for some work I am doing...."

"I found your Matlab functions for peak detection very useful for my research. Thanks for making this resource available, it's been of great help to me". 

"Best fitter available for Matlab, thanks for this wonderful work."

"...hank you for the great work you done with the peak finding methods for Matlab. It is really great."

"I've been using ipeak over the past few weeks and this is a wonderful tool."

"These are very good script(s)....The scripts are very useful to help to solve my problem...."

"[It's] exactly what I needed....The result looks really great!"

"...your interactive peak fitter Matlab tool...it’s a wonderfully powerful and easy to use program.  I have been recommending it to everyone who asks for peak fitting programs".  

"Great code....Wonderfully documented!

"I am using your peakfitter in Matlab and love it....worked like a charm

"I've been having great success with ipf and peakfit..."

"...it really is a fine manual - your pdf document on curve fitting." 

"Your Interactive Peak Fitter ... is very helpful."

"Your peak finding and fitting scripts ... turned out handy in analyzing my research data."

"I found your peakfit.m program and it is great - thank you very much for sharing it!"

"...the codes for finding peaks and mathematical fits to noisy data...were very helpful for my experimental work."

"I appreciate all the work that must have gone into the PeakFit matlab coding. I've been using it ... and it is becoming extremely useful."

",,,your Matlab function findpeaks()...is quite literally EXACTLY what I was looking for and far better than I could have hoped."

"...MATLAB code for scientists! It's such a great resource to have.... I really appreciate your efforts."

"Thank you for making available your absolutely superb Peakfinder software. It is a snap to use...."

"Wonderful program."

"This program is fantastic."

"... incredibly useful
Interactive Fourier Filter...."

"... thanks for all the spectroscopy MatLab scripts that you have written and meticulously documented.  Finding them has saved me more than a few hours."

"... excellent piece of software...really useful and instructive".

"... such a wonderful tool for derivative spectroscopy, it has been much help for me!

"...Interactive Fourier Filter is a great tool ... and best of all, you can view the effect of filtering parameters on your time-series as you change them! " (reference)

" I have been using iSignal for the past day to analyze my data, and it works GREAT!.... I am able to extract lots of information from my spectra now."

" ...your peak finding utilities ... are very well done and easy to use."

"...such a great analysis program....Thank you...for designing such a wonderful program."

"...the tutorials on your website have been of tremendous help to me."

"My data is quite noisy and yet your program is able to fit it with a very low error."

"Your web site has helped me a lot to solve one problem, I will send to you the paper after publishing, so you will see how much important it was for me."

"Your [iSignal] function is very good to explore the smoothing and differentiation filters, I'll recommend it to my new colleagues".

"Thank you for your valuable website & code."

"...it is going to help my research tremendously."

"...your homepage about peak finding and measurement is amazing!"

"This is great. Thank you!"

"...thanks for the great tool! Saved me a lot of work."

"...iPeak ... is very useful."

"...your scripts are wonderful."

"...really nice tutorial and Matlab functions that are extremely useful in many fields of research."

"I used your peakfit MATLAB file in a paper. I found it VERY useful ."

"I have been impressed by your MATLAB codes."

"Wow! ... this is exactly what I needed."

"You programs work very well and are very helpful to me. "

"...very convenient and well-written..."

"...your interactive peak fitter code for Matlab...has been very useful!"

index previous next

Copyright (c) 2014, 2017 Thomas C. O'Haver
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sub-license, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.


First edition created in 2006. Last updated March, 2017. Created with SeaMonkey. This page is part of "A Pragmatic Introduction to Signal Processing", a retirement project and international community service, created and maintained by Prof. Tom O'Haver , Department of Chemistry and Biochemistry, The University of Maryland at College Park. Comments, suggestions and questions should be directed to Prof. O'Haver at toh@umd.edu. Number of unique visits to this website since May 17, 2008: