When using the cftool, should I use Trust Region or Levenberg-Marquardt?

33 次查看(过去 30 天)
Hello,
I have a data-set that behaves like a sin wave. I need to fit a curve to the data-set using the cftool. In the fit options, there are two algorithms I can choose from: 'trust-region' or 'Levenberg-Marquardt'.
I am trying to figure out the difference between the two algorithms, which algorithm is better, and why. Below is my code, and a screenshot of the curve fitting tool as well as my fit options. Thanks in advance.
%Who: Wesley Brown
%Input: PPP orthometric heights
%Process:Curve fitting
%Output: a1, a2, etc.
clear
format longg
%Time matrix in days
x = [0
90
180
270
360
450
540
630
720
810
900
990
1080
1170
1260
1350
1440];
%Y matrix (change in orthometric height from day 1)
y = [ 0
0.00799999999998136
0.007000000000005
0.00799999999998136
0.000999999999976353
-0.0010000000000332
0.0129999999999768
0.0149999999999864
0.0109999999999673
0.00200000000000955
0
0.0029999999999859
-0.007000000000005
0
-0.00300000000004275
0.00200000000000955
-0.0080000000000382];
cftool(x(:,1),y(:,1));
  5 个评论
Walter Roberson
Walter Roberson 2020-1-22
编辑:Walter Roberson 2020-1-24
I am not able to answer the question of which is better or why. The algorithms are described at https://www.mathworks.com/help/optim/ug/equation-solving-algorithms.html
With the data and model you have, your question is like asking whether a chicken or a platypus is a better approximation for a snake.
Walter Roberson
Walter Roberson 2020-1-24
You can get a slightly better fit near
5.84357338824362e-05 2.58183128710864e-05 0.00521135858653424 -0.199178847293523 0.678796516975015 -2.289596742701e-08
These parameters are not unique! The sign of the 3rd one can change, and the 5th one involves semi-periodic behavior about pi/180 apart. The 4th one is periodic as well...
It is still a pretty ugly fit. The model is a terrible one for explaining the data.

请先登录,再进行评论。

采纳的回答

Matt J
Matt J 2020-1-22
编辑:Matt J 2020-1-22
You can read here about the relative limitations of the 2 algorithms,
For you, I expect the decision on which algorithm to use will depend on whether you wish to impose bounds on the parameters. Levenberg-Marquardt does not handle bound constraints. It's not really even a decision. If you try to impose bounds, cftool will default to the trust-region algorithm.

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Get Started with Curve Fitting Toolbox 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by