I would like to ask how to perform nonlinear fitting with two fixed endpoints. Thank you very much for your answer.
조회 수: 3 (최근 30일)
이전 댓글 표시
The data is shown in the attachment
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/933624/image.jpeg)
채택된 답변
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
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File 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!