필터 지우기
필터 지우기

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