Fitting a fourth order polynomial

15 ビュー (過去 30 日間)
Christopher Peter Wutti
Christopher Peter Wutti 2022 年 3 月 31 日
編集済み: Matt J 2022 年 3 月 31 日
Hell everybody, i am trying to fit my data. The theory says that it should be a fourth order polynomial (a * x^4 + c). I used the command fitobject = fit(x,y, 'poly4'), but obviously this does not work, because it gives me a function of the form (ax^4 + bx^3 + c^x^2 + dx + e). I also tried the command fit = polyfit(x,y,4); but this seems to produce the same outcome. So I am a little lost how to do such a fit in matlab.
Thank you for you help in advance!
Best regards!
Christopher

採用された回答

Matt J
Matt J 2022 年 3 月 31 日
編集済み: Matt J 2022 年 3 月 31 日
You can use bounds to force the unwanted coefficients to zero.
lb=[-inf,0,0,0,-inf];
fitobject = fit(x,y, 'poly4','Lower',lb,'Upper',-lb);
  2 件のコメント
Christopher Peter Wutti
Christopher Peter Wutti 2022 年 3 月 31 日
Hello, thank you very much for the answers, this is wonderful, now I get a polynomial of the form a x^4 + bx + c, so is there a way to also fix the 'b' to 0 ?
Torsten
Torsten 2022 年 3 月 31 日
編集済み: Torsten 2022 年 3 月 31 日
lb = [-Inf ,0, 0, 0, -Inf];
Matt forgot one "0".

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

その他の回答 (0 件)

カテゴリ

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

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by