Changing parameters in an ODE model
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
I have created an estimation ode model, and now I would like to test different parameter values to see which is a best fit. So far I have this:
z=0;
f = [1 2 3]
ft =[1 2 3];
g = [4 5 6];
gt = [1 2 3];
Time = [0 30];
IC = 2.5;
for a = [1:3]
for b = [1:3]
Q = [a b];
[t,y] = ode45(@(t,y) Test(t,y,Q,ft,f,gt,g), Time, IC);
end
y=y'
z=z+1;
out(z,:) = [a b y]
end
Which works for single values, i.e a = 1 and b=1, but the moment i try to change the values it gives me the error; Subscripted assignment dimension mismatch.
My ODE file is
function dydt = Test(t,y,Q,ft,f,gt,g)
f = interp1(ft, f, t,'linear', 'extrap');
g = interp1(gt, g, t, 'linear', 'extrap');
dydt = Q(1)*f+Q(2)*g*y;
end
It all works before I tried to change it to test a range of parameters. Essentially I just want it to test each value individually and store the results away, which is what I tried to do with the 'out' function, but I cannot seem to get it to work. Any help would be greatly appreciated.
0 commentaires
Réponses (0)
Voir également
Catégories
En savoir plus sur Ordinary Differential Equations dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!