Levenberg–Marquardt algorithm - Voigt function with area

I post here a low-level Levenberg–Marquardt algorithm to fit the Voigt function with the area.
Updated 4 Feb 2022

View License

The Voigt function is given by the convolution of Lorentz function and Gauss function. I've never used this specific function until I had collaboration with scientists using Raman spectroscopy. In Raman spectroscopy, it is needed to deconvolve Raman peaks to the Lorentz and Gaussian functions using non-linear least squares fitting. Here, the low-level Levenberg–Marquardt algorithm is posted to do such a fitting. The anonymous function in Matlab is used to define Voigt function. The general form of Levenberg–Marquardt algorithm presented here is taken from on-line available material "METHODS FOR NON-LINEAR LEAST SQUARES PROBLEMS" written by K. Madsen, H.B. Nielsen, O. Tingleff from Technical University of Denmark. The fitting parameters in my algorithm are offset, area, width of Lorentz peak, width of Gaussian peak and center position. Please enjoy the algorithm.
It is possible to transfer presented principles from Matlab to C++ using Eigen linear algebra library if needed. In practice, sometimes we develop specific algorithms in Matlab because Matlab provides us convenient environment for mathematical modelling. Later Matlab code can be rewritten to the C++ for faster and more advanced applications.

Cite As

Karol Vegso (2024). Levenberg–Marquardt algorithm - Voigt function with area (https://www.mathworks.com/matlabcentral/fileexchange/106205-levenberg-marquardt-algorithm-voigt-function-with-area), MATLAB Central File Exchange. Retrieved .

MATLAB Release Compatibility
Created with R2021b
Compatible with R2018a to R2021b
Platform Compatibility
Windows macOS Linux
Tags Add Tags

Community Treasure Hunt

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

Start Hunting!
Version Published Release Notes

The clarity of the algorithm was improved.