简体   繁体   English

levenberg marquardt曲线拟合MATLAB有几个参数

[英]levenberg marquardt curve fitting MATLAB with several parameters

I am trying to fit a huge function with four unknown parameter to my data with levenberg-Marquardt least square method in Matlab. 我试图用Matlab中的levenberg-Marquardt最小二乘法在我的数据中拟合一个带有四个未知参数的巨大函数。 I used this command : 我使用了这个命令:

[x, resnorm]=lsqcurvefit(@myfun1,[-100:100], xdata, ydata, ...
                         [-inf, -inf, -1.5, -inf], [inf, inf, 1.5, inf], options)

which means I am interested to constrain the third parameter. 这意味着我有兴趣约束第三个参数。 But I face with this problem: 但我面对这个问题:

??? Error using ==> lsqncommon at 102
Levenberg-Marquardt and Gauss-Newton algorithms do not handle bound constraints and trust-region-reflective algorithm
requires at least as many equations as variables; aborting.

Error in ==> lsqcurvefit at 258
[xCurrent,Resnorm,FVAL,EXITFLAG,OUTPUT,LAMBDA,JACOB] = ...

I think this error shows that my data is small since they are 36 points or maybe there are too many unknown parameters, but I think four unknown parameters for fitting is fine! 我认为这个错误表明我的数据很小,因为它们是36分或者可能有太多的未知参数,但我认为四个未知的参数拟合很好!

so, what do you think ?Does it mean that MATLAB is not able to fit my function to this 36 points data? 所以,您怎么看?这是否意味着MATLAB无法使我的功能适应这36点数据?

I'd appreciate any comments. 我很感激任何评论。

According to this http://www.mathworks.co.uk/help/toolbox/optim/ug/lsqcurvefit.html the second argument is the the start values of the parameters that you wish to optimise for. 根据这个http://www.mathworks.co.uk/help/toolbox/optim/ug/lsqcurvefit.html ,第二个参数是您希望优化的参数的起始值。 You are passing in 你在路过

 [-100:100]

which (unless matlab has greatly changed since I last used it) is a vector of 201 parameters and so it would seem that you are asking matlab to optimise over 201 parameters. 其中(除非matlab自我上次使用以来发生了很大的变化)是一个201参数的向量,所以你似乎要求matlab优化超过201个参数。 As @Dan points out in the comment below, you only have 36 data points and so what you are asking is unreasonable . 正如@Dan在下面的评论中指出的那样,你只有36个数据点,所以你所要求的是不合理的。 You want to optimise over just 4 params so you should input just 4 start values. 您希望优化仅4个参数,因此您应该只输入4个起始值。 You are passing in length 4 vectors for the limit options so you have an inconsistency here. 您传递的长度为4的向量用于限制选项,因此您在此处存在不一致。

I would suggest just inputting a vector of 4 start values for your parameters as second argument and see if it generates the outcome you expect. 我建议只输入一个4个起始值的向量作为第二个参数,看看它是否产生了你期望的结果。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM