I would like to ask how to perform nonlinear fitting with two fixed endpoints. Thank you very much for your answer.

1 次查看(过去 30 天)
The data is shown in the attachment

采纳的回答

Torsten
Torsten 2022-3-20
编辑:Torsten 2022-3-20
If your fitting function depends on n parameters to be fitted, the condition that the function passes through 2 fixed points makes you loose 2 free parameters.
If you are not able to solve for 2 of the n parameters by the imposed 2 conditions, use "fmincon" for the fitting and define the two conditions in function "nonlcon".
E.g. if you have a polynomial of degree 3 for fitting
P(x) = a0 + a1*x + a2*x^2 + a3*x^3
and you want
P(x0) = y0, P(x1) = y1,
you have the two additional equations
y0 = a0 + a1*x0 + a2*x0^2 + a3*x0^3
y1 = a0 + a1*x1 + a2*x1^2 + a3*x1^3
Now you could solve for a0 = f0(a2,a3,x0,y0,x1,y1) , a1 = f1(a2,a3,x0,y0,x1,y1) and insert these expressions into the fitting function:
P(x) = f0(a2,a3,x0,y0,x1,y1) + f1(a2,a3,x0,y0,x1,y1)*x + a2*x^2 + a3*x^3
You see: now P only depends on 2 = 4-2 parameters to be fitted, namely a2 and a3.

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Quadratic Programming and Cone Programming 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by