How to extract the function from curve fitting tool in Matlab
22 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
zein
el 17 de Dic. de 2020
Comentada: zein
el 8 de En. de 2021
I want to extract the function for my data points. I used interpolant witg linear method as indicated in the figure below.
Is it possible to extract a function for the new curve produced by curve fitting as i want to integrate the equation to get the area under the curve?
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/463820/image.png)
0 comentarios
Respuesta aceptada
Más respuestas (1)
Ameer Hamza
el 17 de Dic. de 2020
Editada: Ameer Hamza
el 17 de Dic. de 2020
No, in the case of interpolated curve fitting, it is not possible to get a nice and simple equation. It uses several linear equations in a piecewise manner to create the curve. However, it is still possible to integrate it. First, export the model to the workspace by right-clicking it in the "Table of Fits" section. The export model (name it fittedmodel in this example) supports functional syntax to evaluate the value. For example, you can write
fittedmodel(0.01)
to get the value at x = 0.01. You can integrate it like this
integral(@(x) fittedmodel(x).', 0, 0.03)
3 comentarios
Ver también
Categorías
Más información sobre Interpolation en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!