Scripting a derivation - integration from XY values
显示 更早的评论
Hello everyone,
I am working on a project and my last thing is calculate a value from an analysed results.
I have M - T values at constant H. And try to do that (I gave below) step by step calculation at MATLAB but I can not imagine my scriptting.
- Plot M(T,H) (H = Constant) -> I have already M - T values (H constant)
- Perform numerical differantiation of the function M(T,H) with respect to T. -> I used polyfit(T,M,2)
- Plot dM(T,H)/dT (T = constant) from dM(T,H)/dT (H = constant) -> I did not realize it.
- Numerical integration of the function dm(T,H)/dT (T=constant) with respect to H. -> Also this one.
OK, I generate a function by using polyfit for M and T values but I did not understand other steps. Can anyone help me?
Thank you!
4 个评论
dpb
2020-7-11
polyfit isn't differentiation, it's fitting a polynomial (in your example a quadratic) to the data.
Semih Ates
2020-7-11
John D'Errico
2020-7-11
编辑:John D'Errico
2020-7-11
You don't necessarily need to create a function. This introduces error, because the approximation will have lack of fit to your data.
For example, you can use the gradient function to differentiate a data series.
You can use trapz or cumtrapz to integrate a data series.
It depends on how much noise is is the data, and how good of an approximation is your curve fit. You may easily be introducing more error into the problem just by your use of a polynomial fit. Without seeing the data and the fit you choose, I would need to say that you need to consider which option is correct.
Semih Ates
2020-7-11
回答(0 个)
类别
在 帮助中心 和 File Exchange 中查找有关 Numerical Integration and Differentiation 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
