How do I solve a system of nonlinear differential equations like the one below?

2 次查看(过去 30 天)
As seen below (ode1 ode2 ode3) are my equations and c_1 to c_9 are just some constants which will be later determined. Is there any way to solve this without numerical methods? Thank you!
syms x(t) y(t) z(t);
c_1 = 1
c_2 = 2
c_3 = 1
c_4 = 1
c_5 = 1
c_6 = 1
c_7 = 1
c_8 = 1
c_9 = 1
ode1 = diff(x,t) == c_1*(c_3-x) + c_2*(x-y);
ode2 = diff(y,t) == c_4*(x-y) - c_5*c_6*y*(1-z) + c_7*c_6*exp(c_8 - c_9*z);
ode3 = diff(z,t) == c_5*y*(1-z) - exp(c_8 - c_9*z);
odes = [ode1; ode2; ode3]
cond1 = y(0) == 0;
cond2 = x(0) == 0;
cond3 = z(0) == 0;
conds = [cond1 cond2 cond3];

采纳的回答

Star Strider
Star Strider 2021-3-18
Add t and Y to the syms declaration, and add these to the end of the posted code:
[VF,Subs] = odeToVectorField(odes);
odefcn = matlabFunction(VF, 'Vars',{t,Y});
Then use ‘odefcn’ with the numerical ODE integrator of your choise (such as ode45) to integrate them numerically.
Use the ‘Subs’ variable to determine the variable assignment order in the function and in the outputs of the integration.
  2 个评论
Star Strider
Star Strider 2021-5-2
As always, my pleasure!
Try this —
syms x(t) y(t) z(t) t Y
c_1 = 1
c_1 = 1
c_2 = 2
c_2 = 2
c_3 = 1
c_3 = 1
c_4 = 1
c_4 = 1
c_5 = 1
c_5 = 1
c_6 = 1
c_6 = 1
c_7 = 1
c_7 = 1
c_8 = 1
c_8 = 1
c_9 = 1
c_9 = 1
ode1 = diff(x,t) == c_1*(c_3-x) + c_2*(x-y);
ode2 = diff(y,t) == c_4*(x-y) - c_5*c_6*y*(1-z) + c_7*c_6*exp(c_8 - c_9*z);
ode3 = diff(z,t) == c_5*y*(1-z) - exp(c_8 - c_9*z);
odes = [ode1; ode2; ode3]
odes(t) = 
[VF,Subs] = odeToVectorField(odes)
VF = 
Subs = 
odefcn = matlabFunction(VF, 'Vars',{t,Y});
[t,y] = ode45(odefcn, [0 50], zeros(1,3)+1E-8);
figure
plot(t, y)
grid
legend(string(Subs), 'Location','best')
ylim([-1 1]*5)
.

请先登录,再进行评论。

更多回答(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