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;

采纳的回答

Walter Roberson
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 CenterFile Exchange 中查找有关 Ordinary Differential Equations 的更多信息

标签

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by