How to use the Levenberg-Marquardt algorithm to fitting data and get the first derivative?

495 次查看(过去 30 天)
I'm implementing the Levenberg-Marquardt algorithm in matlab to minimize a set of data resulting from a black-box equation.
My question is how to calculate the jacobian matrix from the set of data?
  3 个评论
Zakaria OUAOUJA
Zakaria OUAOUJA 2021-10-4
That's exactly what I am trying to do, I am trying to minimize an output data resulting from a black-box software equations, and I am using the finite difference approximation for the Jacobian but it never works, and I can't find something helpful on the internet.
If you have solved the problem I would appreciate it if you could help me solve it too.

请先登录,再进行评论。

回答(2 个)

Robert U
Robert U 2019-2-25
Hi Nelson Saraiva,
The Levenberg-Marquardt algorithm is already ready-to-use implemented into optimization toolbox: https://de.mathworks.com/help/optim/ug/lsqcurvefit.html?searchHighlight=lsqcurvefit&s_tid=doc_srchtitle
There are lots of descriptions on implementation on the internet. As an example, with implementation: http://people.duke.edu/%7Ehpgavin/ce281/lm.pdf
For most curve-fitting algorithms you have to have a model function defined with a set of free parameters. In order to find best fitting results with as less iterations as possible some algorithms (see gradient descent methods) do implement a kind of sensitivity analysis on all the free parameters. That would be the Jacobian matrix. Thus, Jacobian matrix does not depend on your data set but on the model function you chose.
Kind regards,
Robert
  2 个评论
Naif Alsalem
Naif Alsalem 2021-6-24
Robert,
I came by your answer and i though it is very informative. If you dont mind, i have, say, measured & predicated spectra that i need to compare using LM method in matlab.
X= measured; Y= predicated;
How would i used LM function that is already included in matlab to fit these spectra?
Thank you very much in advance.
Abhilash Awasthi
Abhilash Awasthi 2022-9-15
@Naif Alsalem you can define your objective function as the difference between X & Y as a column vector. Then you can use the MATLAB inbuilt function 'lsqnonlin' from Optimization toolbox. You can also play with the options if you want to have a better control over your algorithm. Check this link for more details.

请先登录,再进行评论。


Dhananjaya
Dhananjaya 2023-10-10
I want to train a neural network with some simulated data using Levenberg-Marquardt algorithm. Can anyone provide me the code.

类别

Help CenterFile Exchange 中查找有关 Solver Outputs and Iterative Display 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by