File Exchange

image thumbnail

ipf(arg1,arg2,arg3,​arg4)

version 13.2.0.0 (6.31 MB) by Tom O'Haver
Keyboard operated peak fitting function for time-series signals.

14 Downloads

Updated 23 Dec 2018

View Version History

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. See http://www.wam.umd.edu/~toh/spectrum/InteractivePeakFitter.htm for more information. Version 13.2, December 2018: D key saves model to disc as SavedModel.mat, containing two matrices: DataSegment and ModelMatrix. To place model in the workspace, type load SavedModel; to plot saved DataSegment, type plot(DataSegment(:,1), DataSegment(:,2)); to plot SavedModel, type plot(ModelX,ModelMatrix); each component in the model will be plotted in a different color.

Cite As

Tom O'Haver (2021). ipf(arg1,arg2,arg3,arg4) (https://www.mathworks.com/matlabcentral/fileexchange/23452-ipf-arg1-arg2-arg3-arg4), MATLAB Central File Exchange. Retrieved .

Comments and Ratings (27)

Andrei Dioumaev

Joao Figueira

Thanks for the update Tom, very nice of you!

Tom O'Haver

New version, uploaded today, based on a suggestion by Joao, changes the action of the D key to save the model data to disc as SavedModel.mat, rather than just printing it out. SavedModel.mat contains two matrices: DataSegment and ModelMatrix. To place these data in the workspace, type load SavedModel; to plot saved DataSegment, type plot(DataSegment(:,1), DataSegment(:,2)); to plot SavedModel, type plot(ModelX,ModelMatrix); each component in the model will be plotted in a different color.

Jason Hanson

enjoyed the updates :)

Tom O'Haver

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

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

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

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

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

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

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

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

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

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

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

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

Thomas Schlothauer

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

Andre Guy Tranquille

Tom O'Haver

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

Wang Hai

good

John D'Errico

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

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.

MATLAB Release Compatibility
Created with R2017b
Compatible with any release
Platform Compatibility
Windows macOS Linux
Acknowledgements

Inspired: peakfit.m

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!