How can I find the best curve of a set of curves to fit data points?
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
This is for modelling a chemical reaction A -> B, though ideally the process could be modified to account for reversible and more complex reactions.
Say I have a set of curves of a=a0 * exp(-kt) where x0 is the initial x value, k is the rate of conversion of A to B, and t is time in an interval (normally about one second). The time interval doesn't vary, and a0 is a value known in advance. Thus, if I run a reaction and gather data on the amount of chemical A, how do I fit curves with varying k values to the data? My thinking was using one of the least squares fit modes in the optimization toolbox, but then the question is which one is best and how do I use it such that it spits out a value for k.
Thanks!
0 Kommentare
Antworten (2)
dpb
am 28 Feb. 2020
How can there be a question of "which one is best"? You have a physical model and one constant, k, to estimate so a least squares estimate will be the best for that data set.
It's not clear what data you have collected, however...do you have the concentration of A vs t, or only the final concentration at the end of the time interval?
Is it the same reaction with a set of time histories for each or one measurement for a set of different reactants?
So many questions, so few answers... :)
Image Analyst
am 28 Feb. 2020
Not sure I know exactly what you want (since you didn't show any pictures, code, or data), but for what it's worth, see my attached code that solves the rate equation with fitnlm().
If you'd rather have an exponential decay rather than the chemical rate equation, I've attached demos for that as well.
Siehe auch
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!