How can I plot the graph of three non-linear coupled ODE's vs. time in xy-plane in MATLAB. I want to use x-axis for time while y axis for x(1),x(2),x(3) thanks
1 回表示 (過去 30 日間)
古いコメントを表示
My ODE's are:
k_1*x(2)-k1*x(1)-k3*x(1)*x(2)+k_3*x(3);
k1*x(1)-(k_1+k2)*x(2)-k3*x(1)*x(2)+(k4+k_3)*x(3);
k3*x(1)*x(2)-(k4+k_3)*x(3)
where parameter values are as given below
k1 = 1.5;
k_1 = 0.5;
k2 = 1;
k3 = 2;
k_3 = 1;
k4 = 3;
0 件のコメント
採用された回答
Walter Roberson
2021 年 12 月 8 日
tspan = [0 10];
x0 = [0 0.1 0.2];
[t, x] = ode45(@odefun, tspan, x0);
plot(t, x);
legend({'x(1)', 'x(2)', 'x(3)'}, 'location', 'best');
function dk = odefun(t, x)
k1 = 1.5;
k_1 = 0.5;
k2 = 1;
k3 = 2;
k_3 = 1;
k4 = 3;
dk = [k_1*x(2)-k1*x(1)-k3*x(1)*x(2)+k_3*x(3);
k1*x(1)-(k_1+k2)*x(2)-k3*x(1)*x(2)+(k4+k_3)*x(3);
k3*x(1)*x(2)-(k4+k_3)*x(3) ];
end
その他の回答 (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!