Changing parameters in an ODE model
조회 수: 1 (최근 30일)
이전 댓글 표시
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
답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Ordinary Differential Equations에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!