Lorentzian fit for defined peak

42 views (last 30 days)
Dear all,
I have the spectrum contained several peaks which I would like to fit with Lorentz distribution. Do you know some easy and elegant ways (probably already included to MATLAB) where I can define maximum (x0,y0) and width of the distribution's bell (in the best case using Live Script) and apply this fit for separate peak. Any sollutions with GUI are highly welcome!
Thank you in advance!

Accepted Answer

Star Strider
Star Strider on 3 Oct 2023
First, locate the peaks using findpeaks or islocalmax to get the peak values (amplitudes) and locations. The findpeaks function also has an option to estimate the widths, and to get FWHM, use the name-value pair 'WidthReference','halfheight' (islocalmax does not have a similar option). Then as far as the fitting goes, iterate over the peakss in a loop to fit each one. I posted a similar solution in How to Extract/Fit bell curves under a time series... and while I can’t find an implementation of the Lorenz distribution, the File Exchange has the cauchy function (that appears to be well-regarded, although I’ve never had the occasion to need it so I have no experience with it).
If your spectrum nas baseline variation you want to eliminate, there are ways to do that as well.

More Answers (0)

Products


Release

R2023a

Community Treasure Hunt

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

Start Hunting!