MATLAB: 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.

differential equationdsolveode

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')

Best Answer

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.