Fitting a fourth order polynomial
15 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Christopher Peter Wutti
le 31 Mar 2022
Modifié(e) : Matt J
le 31 Mar 2022
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
0 commentaires
Réponse acceptée
Matt J
le 31 Mar 2022
Modifié(e) : Matt J
le 31 Mar 2022
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);
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Get Started with Curve Fitting Toolbox dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!