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(ode1,ode2,ode3,ode4) or dsolve(odes) and never it finishes.
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Sourin Dey
am 4 Nov. 2017
Beantwortet: Walter Roberson
am 4 Nov. 2017
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')
0 Kommentare
Akzeptierte Antwort
Birdman
am 4 Nov. 2017
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.
0 Kommentare
Weitere Antworten (1)
Walter Roberson
am 4 Nov. 2017
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.
0 Kommentare
Siehe auch
Kategorien
Mehr zu Equation Solving finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!