how to solve this differential equations with dsolve

1 vue (au cours des 30 derniers jours)
Furkan
Furkan le 23 Déc 2016
Commenté : John BG le 25 Déc 2016
x'+2x+y=0
y'+x+2y=0
t=0 => x=1 , y=0

Réponse acceptée

Star Strider
Star Strider le 23 Déc 2016
It is straightforward to incorporate the initial conditions in the dsolve call:
syms x(t) y(t)
Dx = diff(x);
Dy = diff(y);
[x,y] = dsolve(Dx + 2*x + y == 0, Dy + x + 2*y == 0, x(0) == 1, y(0) == 0)
x =
exp(-t)/2 + exp(-3*t)/2
y =
exp(-3*t)/2 - exp(-t)/2
  5 commentaires
Furkan
Furkan le 23 Déc 2016
Thanks Mr. John BG but first part of answer already enough for me, ı dont need more details at this problem.But both of answers are correct and usefull thanks . Best regards.
John BG
John BG le 25 Déc 2016
it's ok, thanks for reading my answer

Connectez-vous pour commenter.

Plus de réponses (1)

John BG
John BG le 23 Déc 2016
Modifié(e) : John BG le 23 Déc 2016
1.
solving the system
syms x(t) y(t)
z=dsolve(diff(x)==-y-2*y,diff(y)==-x-2*y)
z.x
=
C2*exp(-3*t) - 3*C1*exp(t)
z.y
=
C1*exp(t) + C2*exp(-3*t)
2.
applying initial conditions, A(t=0):
A=[1 -3;1 1]
b=[1;0]
s=A\b
=
0.250000000000000
-0.250000000000000
C1=s(1)
C1 =
0.250000000000000
C2=s(2)
C2 =
-0.250000000000000
3. Build real functions
fx=matlabFunction(z.x)
fx =
@(C1,C2,t)C1.*exp(t).*-3.0+C2.*exp(t.*-3.0)
fy=matlabFunction(z.y)
fy =
@(C1,C2,t)C1.*exp(t)+C2.*exp(t.*-3.0)
t=[10:.1:10]
fx(C1,C2,t)
=
-1.651984934610504e+04
fy(C1,C2,t)
=
5.506616448701680e+03
if you find these lines useful would you please mark my answer as Accepted Answer?
To any other reader, please if you find this answer of any help, click on the thumbs-up vote link,
thanks in advance for time and attention
John BG

Community Treasure Hunt

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

Start Hunting!

Translated by