I would like to ask how to perform nonlinear fitting with two fixed endpoints. Thank you very much for your answer.
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
Wesley
el 20 de Mzo. de 2022
The data is shown in the attachment
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/933624/image.jpeg)
Respuesta aceptada
Torsten
el 20 de Mzo. de 2022
Editada: Torsten
el 20 de Mzo. de 2022
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 comentarios
Más respuestas (0)
Ver también
Categorías
Más información sobre Quadratic Programming and Cone Programming en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!