File Exchange

image thumbnail

ipf(arg1,arg2,arg3,​arg4)

version 11.3 (160 KB) by

Keyboard operated peak fitting function for time-series signals.

11 Downloads

Updated

View License

An interactive peak fitting program for time-series signals, written as a self-contained function in a single m-file. Uses 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 20 peak shapes. See http://www.wam.umd.edu/~toh/spectrum/InteractivePeakFitter.htm for more information. Version 11, October, 2015. Version 11.3 adds lognormal model(o); minimum peak width constraint (Shift-W); saturation maximum (shift-M) to ignore points above saturation maximum.

Comments and Ratings (23)

Tom O'Haver

Tom O'Haver (view profile)

Version 9.2, uploaded today, has bug fixes; fixed-position Gaussians (shape 16) and fixed-position Lorentzians (shape 17); adds a peak shape selection menu (activated by the '-' key).

Tom O'Haver

Tom O'Haver (view profile)

Version 8.61 adds a simple built-in IQR function for those who don't have the Statistics Toolbox. This is used only by the bootstrap routine (V key).

Tom O'Haver

Tom O'Haver (view profile)

Version 8.6 adds Fixed-width Gaussian (Shift-G key; shape number 11) and Fixed-width Lorentzian (Shift-L key; shape number 12)

Tom O'Haver

Tom O'Haver (view profile)

Just trying to make it work, Ragaar. I'm basically a pragmatist, designing tools from the user's point of view, not a programming purist.

Ragaar Ashnod

Why are you using global variables and adjusting the format and warnings displayed?

I'm not going to bother digging everything apart. But the functionality is neat.

Tom O'Haver

Tom O'Haver (view profile)

Re: Mark Shore's comment. I agree; I guess I'm a retrograde kind of guy. I've considered creating a GUI, but attempts so far have not produced anything I like better than the single-key commands. It's quicker to hit one key than to hold down the Ctrl-key and another key to select a drop-down menu item.

mohammad

perfect Tom

Mark Shore

I find the keyboard commands a bit retrograde in 2011, but that is a personal thing.

I haven't explored all the options in detail yet, so the rating is somewhat preliminary.

Tom O'Haver

Tom O'Haver (view profile)

Version 5.5 (August 16, 2011) adds equal-width Gaussian and Lorentzian peak shapes and an 8-point baseline subtraction option (expandable to any number of points).

Tom O'Haver

Tom O'Haver (view profile)

Version 5.4 has greater flexibility of data input formats (e.g. it can accept data whose x-axis values are decreasing as well as increasing).

Tom O'Haver

Tom O'Haver (view profile)

Version 5.2 (July 26, 2011) includes bug fixes in the Print peakfit function (W) and exponentially-broadened Gaussian. Re-formats the peak table on the graph.

See http://terpconnect.umd.edu/~toh/spectrum/InteractivePeakFitter.htm

Tom O'Haver

Tom O'Haver (view profile)

Version 5.0 (July 15, 2011) adds: graph of fitted peaks on the full signal display; Y command to display the entire signal full screen without cursors; various UI improvements and bug fixes.

Tom O'Haver

Tom O'Haver (view profile)

DongSheng, there is no way to do that in the current version. You can see the fits only in the region fitted. I'll consider adding what you want in a future version. Thanks.

Dongsheng

When I use this to find peaks it always displays a zoomed in area for the fit. How can I show the entire plot with the fits?

Tom O'Haver

Tom O'Haver (view profile)

The new version 4.4 includes several small bug fixes and display improvements. The peak table displayed on the graph after a fit now has column headings.

Tom O'Haver

Tom O'Haver (view profile)

Remove (or comment out) the that line from the m-file. Evidently the syntax of that command has changed since my version of Matlab.

If I will start the interactive peak fitter, I get the following information:

??? Error using ==> warning
Unknown setting or incorrect message identifier 'Exiting:'.

Error in ==> InteractivePeakFitter at 22
warning('OFF','Exiting:')

What was my mistake here?
Kindly regards by Thomas

Tom O'Haver

Tom O'Haver (view profile)

Version 4: April 2008: Added keypress function "x" to refine the fit by performing 10 trial fits with slightly different first guesses and take the one with the lowest fitting error. You can change the number of trials, "NumTrials", in line 69 (the default is 10)

Lissa

Lissa (view profile)

Wang Hai

good

John D'Errico

John D'Errico (view profile)

Please do not upload two copies of the same file. If you wish to update a file, then click on the update link on the file page.

Delete one of the copies.

Tom O'Haver

Tom O'Haver (view profile)

This latest version (3.3) add two features:

1. It computes the model at 100 points regardless of number of data points, giving the graph a smoother appearance.

2. A new keypress function, "d", to print out x,y values of the current data segment.

Updates

11.3

October, 2015. Version 113 adds lognormal model(o); minimum peak width constraint (Shift-W); saturation maximum (shift-M) to ignore points above saturation maximum.

1.49

Version 11 adds polynomial fits (Shift-o, for pOlyminial), bug fixes, adds Shift-Ctrl-S and Shift-Ctrl-P keys to transfer the current signal to iSignal and iPeak.

1.48

Version 10.4, June, 2014. Moves fitting result text to bottom panel of graph. Log mode (M key) toggles log mode on/off, fits log(model) to log(y). Replaces bifurcated Lorentzian with Breit-Wigner-Fano resonance peak (Shift-B key; Shape=15).

1.47

Version 10.3 adds a "down step" sigmoid (Shift-D; shape #23).

1.46

Version 10.2 fixes some bugs in the X key and C key functions in the bipolar (+ and -) mode.

1.45

Version 10 adds support for multiple-shape models.

1.44

Version 9.84 has some bug fixes related to starting values.

1.43

Version 9.8 adds Shift-C to specify custom first guess ('start' vector).

1.42

Version 9.7 adds Voigt profile shape; corrects for flat baseline if autozero mode 3.

1.41

Version 9.5 adds two new peak shapes: exponentially broadened Lorentzian and the alpha function.

1.39

Version 9.2: bug fixes; Reorganized peak shape table ('-' key)

1.37

Version 9.1 Adds fixed-position Gaussians (shape 16) and fixed-position Lorentzians (shape 17). Adds peak shape selection menu (activated by '-' key)

1.36

Version 9: Accepts additional input arguments to set the initial pan and zoom to focus on the data segment 'window' points wide, centered at x=center.

1.35

Version 8.94: Improved accuracy of autozero calculation.

1.34

Version 8.92: Added elapsed time to Q and R reports; Bug fixes; Slight improvement in speed of exponentially broadened shapes.

1.33

Added Gaussian/Lorentzian blend, bifurcated Gaussian, and bifurcated Lorentzian. Shift-X to enter value of 'Extra' for variable shapes; Shift-A and Shift-Z fine-tune the 'extra' variable. Bug fixes.

1.32

Version 8.8 has no limit in the number of peaks in the model.

1.31

Version 8.61 adds a simple built-in IQR function for those without the Statistics Toolbox.

1.30

Version 8.6 adds Fixed-width Gaussian (Shift-G key; shape number 11) and Fixed-width Lorentzian (Shift-L key; shape number 12)

1.29

Version 8.5, June 2012, Exponential
broadening uses normal rather than circular convolution.

1.27

Enhancements to the bootstrap statistics function.

1.26

Version 8, April 2012, Added bootstrap
sampling estimation of standard deviations of peak parameters ('v' key).

1.25

Version 7.1, Jan. 2012, Bug fixes in
background subtraction modes and in handlng very small data sets.

1.24

Version 7, Oct. 2011, adds linear/log
mode (M key) and exponential pulse and sigmoid models (U and S keys)

1.23

Version 6: T key (autozero) cycles through none, linear, and quadratic background subtraction. Minor bug fixes.

1.18

Version 5.9 adds user-selected number of points in background subtraction.

1.17

Add exponentially-broadened equal width Gaussians peak shape (J key)

1.16

Version 5.5 adds equal-width Gaussian and
 Lortentzians and an 8-point baseline subtraction option.

1.14

Version 5.4, August, 2011: improved flexibility for data input arguments.

1.13

Bug fixes in Print peakfit function (W) and exponentially-broadened Gaussian.

1.12

Version 5.1 July 20, 2011: reformatted peak table on figure window, bug fixes

1.10

bug fix

1.9

Version 5.0 adds: graph of fitted peaks on the full signal display; Y command to display the entire signal full screen without cursors; various UI improvements and bug fixes.

1.8

Some minor big fixes and display improvements.

1.7

Expanded description

1.6

Improved performance on newer versions of Matlab; tested on 7.8 (R2009a).

1.5

Version 4.1, April 18: Added Autozero ON/OFF notification at top, and "k" keypress to print out list of commands.

1.4

 Version 4: April 2008: Added keypress function "x" to refine the fit by performing 10 trial fits with slightly different first guesses and take the one with the lowest fitting error.

1.3

Version 3.5 computes the model at 100 points regardless of number of data points; adds keypress functions "t" to toggle between normal and autozero mode, and "d" to print out x,y values of the current data segment.

MATLAB Release
MATLAB 7.8 (R2009a)

Download apps, toolboxes, and other File Exchange content using Add-On Explorer in MATLAB.

» Watch video