How to adjust parameters in a ode?

I have an equation like this:
dy/dt = alpha * x(t)
The function x(t) is known and I have experimental data for dy/dt.
How can I find the value of alpha adjusting the equation to the experimental data?
Thank you!

 Accepted Answer

David Goodmanson
David Goodmanson on 10 Jul 2017
Edited: David Goodmanson on 10 Jul 2017
Hi Sara
Since you have a single multiplicative parameter, certainly the simplest way is,
create a column vector dydt of your data
create a column vector t of corresponding experimental times
then
prediction = x(t) % assuming x can accept a vector and produce a vector
alpha = prediction\dydt
This works since
alpha x(t) = dy/dt
is a set of n linear equations and one unknown, so Matlab finds a least square solution for alpha. Of course this only works if dydt and the prediction x(t) have some sensible relation to each other, i.e. basically the same shape. More sophisticated solutions are probably possible but this is worth trying first.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!