Scripting a derivation - integration from XY values
13 views (last 30 days)
Show older comments
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 Comments
John D'Errico
on 11 Jul 2020
Edited: John D'Errico
on 11 Jul 2020
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.
Answers (0)
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!