How I can check the system solution with a Matlab ODE function.
1 回表示 (過去 30 日間)
古いコメントを表示
dydt(1) = 1.3*(y(3) - y(1)) + 10400*exp(20.7 - 1500/y(1))*y(2);
dydt(2) = 1880 * (y(4) - y(2) * (1+exp(20.7 - 1500/y(1))));
dydt(3) = 1752 - 269*y(3) + 267*y(1);
dydt(4) = 0.1 + 320*y(2) - 321*y(4)
y(t0)= [50,0,600,1]
0 件のコメント
採用された回答
Jan
2018 年 6 月 11 日
function main
t0 = 0;
y0= [50,0,600,1]
[t,y] = ode45(@fcn, [t0, 7], y0);
plot(t, y);
end
function dydt = fcn(t, y)
dydt = zeros(4,1);
dydt(1) = 1.3*(y(3) - y(1)) + 10400*exp(20.7 - 1500/y(1))*y(2);
dydt(2) = 1880 * (y(4) - y(2) * (1+exp(20.7 - 1500/y(1))));
dydt(3) = 1752 - 269*y(3) + 267*y(1);
dydt(4) = 0.1 + 320*y(2) - 321*y(4);
end
3 件のコメント
Jan
2018 年 6 月 11 日
I guessed the endpoint 7. This takes a long time, in fact. If you use 2, ODE45 can solve this in seconds. ODE45 is designed to integrate non-stiff ODEs. If your system is stiff, use e.g. ode23s.
tic
[t,y] = ode23s(@fcn, [t0, 7], y0);
toc
% Elapsed time is 0.045184 seconds.
その他の回答 (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!