Does the curvefit toolbox return the equation for the best fit line (or curve)?
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
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 Kommentar
Akzeptierte Antwort
the cyclist
am 14 Mai 2024
3 Kommentare
Steven Lord
am 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)
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Get Started with Curve Fitting Toolbox finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!