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 Center および File ExchangeLeast Squares についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by