I failed to solve 4 equation differential equation. I'm giving the code. the same code for two equation worked well. The point the program stuck is dsolve(ode​1,ode2,ode​3,ode4) or dsolve(odes) and never it finishes.

2 ビュー (過去 30 日間)
syms u(t) v(t) x(t) y(t)
ode1 = diff(u,t) == 3*u + 4*v +5*x +6*y;
ode2 = diff(v,t) == -4*u + 3*v +9*x +8*y;
ode3 = diff(x,t) == -3*u + 9*v +4*x +6*y;
ode4 = diff(y,t) == 6*u + 8*v +9*x +5*y;
odes = [ode1;ode2;ode3;ode4];
S = dsolve(odes);
uSol(t) = S.u;
vSol(t) = S.v;
xSol(t) = S.x;
ySol(t) = S.y;
[uSol(t), vSol(t), xSol(t), ySol(t)] = dsolve(odes)
cond1 = u(0) == 0;
cond2 = v(0) == 0;
cond3 = x(0) == 0;
cond4 = y(0) == 0;
conds = [cond1; cond2; cond3; cond4];
[uSol(t), vSol(t), xSol(t), ySol(t)] = dsolve(odes,conds);
ezplot(uSol)
hold on
ezplot(vSol)
hold on
ezplot(xSol)
hold on
ezplot(ySol)
grid on;
legend('uSol','vSol','xSol', 'ySol')

採用された回答

Birdman
Birdman 2017 年 11 月 4 日
Your equations ode1 and ode4 actually contains linearly dependent terms which are
3*u + 4*v(ode1), 6*u + 8*v(ode4)
This situation brings about infinitely many solutions to your system, therefore actually a unique solution can not be found. For instance if you change your term into
6*u + 7*y
in ode4, you will see that a unique solution is quickly found.

その他の回答 (1 件)

Walter Roberson
Walter Roberson 2017 年 11 月 4 日
The solution is u(t) = 0, v(t) = 0, x(t) = 0, y(t) = 0 . MATLAB is able to come up with that solution if you skip right down to the last dsolve after initializing the variables.
You have three dsolve, the first two of which are the same as each other except in how they output the results. The third of them solves the same odes but with boundary conditions, and MATLAB is able to handle that.

カテゴリ

Help Center および File ExchangeEquation Solving についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by