Powell's dog leg method - fitting Voigt function with area

Version 1.0.0 (3.32 KB) by Karol Vegso
I post Powell's dog leg algorithm to fit the Voigt function.
29 Downloads
Updated 14 Feb 2022

View License

Here, I present Powell's dog leg method that is applied to the fitting of Voigt function with area. The Voigt function is given by convolution of Lorentz function and Gauss function. It is useful especially in optical spectroscopy, where deconvolution of your peak to Lorentz and Gauss functions is necessary to calculate.
The general algorithm was taken from document "METHODS FOR NON-LINEAR LEAST SQUARES PROBLEMS" written by authors K. Madsen, H.B. Nielsen, O. Tingleff (Technical University of Denmark). The principles and function of Powell's dog leg method are thoroughly explained in this document. I apply general Powell's dog leg algorithm to Voigt function with area. In order to change the fitting function, you need to rewrite Jacobian matrix, which contains derivatives according to the fitting parameters. The presented algorithm is using mostly Matlab and equation solver Solve from Symbolic Math Toolbox. The solver is used to calculate step in Powell's dog leg method. The fitting parameters are offset, area, width of Lorentz function, width of Gauss function and center.
In the algorithm, there is difference variable with constant value of 1.0e-4. This constant is used in numerical calculations of derivatives according to the fitting parameters. These derivatives are used to calculate Jacobian matrix. Therefore, the Jacobian matrix is calculated numerically and not according to the analytical formulas as I did for Gauss, Lorentz, sinus or cosinus functions (please see other my posts). To fit data sucessfully, it is good if center position is approximately correct. I wish you a lot of fun with testing of Powell's dog leg algorithm. Enjoy the algorithm.

Cite As

Karol Vegso (2024). Powell's dog leg method - fitting Voigt function with area (https://www.mathworks.com/matlabcentral/fileexchange/106735-powell-s-dog-leg-method-fitting-voigt-function-with-area), MATLAB Central File Exchange. Retrieved .

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

Community Treasure Hunt

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

Start Hunting!
Version Published Release Notes
1.0.0