Does the curvefit toolbox return the equation for the best fit line (or curve)?
2 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
For example, let's say that a 5th order polynomial fits the data nicely. Does the curvefit results include the equation, or at least the coefficients, of the 5th order polynomial fit?
Perhaps a silly question, but you might be surprized at how many so-called curve fitting programs are out there that only care about displaying the fit.
Thank you for considering my question.
Todd
1 commentaire
Réponse acceptée
the cyclist
le 14 Mai 2024
3 commentaires
Steven Lord
le 14 Mai 2024
And if you export the fit from the app using the last button on the toolstrip, you'll get a cfit or sfit object. You can use a number of different functions to post-process them.
load census
format longg
f = fit(cdate, pop, 'poly2')
formula(f)
coeffnames(f)
coeffvalues(f)
Note that not all types of fit give formulas you can use to evaluate the fit.
f2 = fit(cdate, pop, 'spline')
formula(f2)
But then again you don't need to use the formula to evaluate it if you have the object.
populationFromQuadratic = f(1849)
populationFromSpline = f2(1849)
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!