how to I get the equation of polynomial fit into my code

5 visualizaciones (últimos 30 días)
Jamie Hobbs
Jamie Hobbs el 25 de Oct. de 2021
Editada: Sulaymon Eshkabilov el 26 de Oct. de 2021
Hi Guys,
I used the basic fittings in the plot function to add a line of best fit, which MATLAB shows on the graph. I know want to use that equation in my code. Is there a better way than just copying it down as it it a very long equation.
Thanks
Jamie

Respuestas (1)

Sulaymon Eshkabilov
Sulaymon Eshkabilov el 26 de Oct. de 2021
Editada: Sulaymon Eshkabilov el 26 de Oct. de 2021
Use these icons to export the fit model into workspace as shown in the Screenshot shown here.
Then use the exported fit model (e.g.: called fit) coefficients, e.g.:
x = 0:13;
FModel = fit.coeff;
FM_vals = polyval(FModel, x);
...

Categorías

Más información sobre Interpolation en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by