Setting up a vector of parameters
5 views (last 30 days)
Show older comments
I'm working on solving a system of differential equations and I'm having trouble setting up a vector of parameters. This is the code for one of my model files:
function dy1dt=LogisticsModel(t,y1,param1)
r1=param1(1);
k1=param1(2);
dy1dt=r1*y1*(1-(y1/k1));
This is the code for the other:
function dy2dt=LogisticsModel2(t,y2,param2)
r2=param2(1);
k2=param2(2);
dy2dt=r2*y2*(1-(y2/k2));
Basically, I just want a vector, param, containing r1, k1, r2, k2. Whenever I try to set it up like
r1=param(1);
k1=param(2);
r2=param(3);
k2=param(4);
I get error messages. I've tried several different methods to do this and I can't figure it out. Please help.
0 Comments
Answers (0)
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!