non-linear fit to find constants in the equation

1 回表示 (過去 30 日間)
Baris Gungordu
Baris Gungordu 2019 年 1 月 25 日
コメント済み: Torsten 2019 年 1 月 29 日
I am trying to implement the following equation:
U = C1 + C2*E+ C3*E^2 + C4*E^3 + C5*E^4, where U and E is known (10 set of values , 10 x 2).
I need to get the constants C1 to C5. Tried fitnlm with no success. Looking forward to get your help.
Example data set:
U E
2.019 1.615
2.622 1.662
3.358 1.706
4.36 1.759
5.621 1.814
7.324 1.877
9.379 1.94
12.121 2.011
15.364 2.081
20.101 2.167

採用された回答

Torsten
Torsten 2019 年 1 月 25 日
E =...; % column vector
U =...; % column vector
A = [ones(numel(E),1), E, E.^2, E.^3, E.^4];
b = U;
sol = A\b;
C1 = sol(1)
C2 = sol(2)
C3 = sol(3)
C4 = sol(4)
C5 = sol(5)
p = [C5 C4 C3 C2 C1];
Usim = polyval(p,E);
plot(E,U,E,Usim)
  6 件のコメント
Baris Gungordu
Baris Gungordu 2019 年 1 月 29 日
Thanks but it is only returning the initial conditions (p0).
Torsten
Torsten 2019 年 1 月 29 日
Maybe the initial guess p0 is far off. Try to use a better p0-vector.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeGet Started with Curve Fitting Toolbox についてさらに検索

製品


リリース

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by