how to solve this differential equations with dsolve
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
Furkan
el 23 de Dic. de 2016
Comentada: John BG
el 25 de Dic. de 2016
x'+2x+y=0
y'+x+2y=0
t=0 => x=1 , y=0
0 comentarios
Respuesta aceptada
Star Strider
el 23 de Dic. de 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 comentarios
Más respuestas (1)
John BG
el 23 de Dic. de 2016
Editada: John BG
el 23 de Dic. de 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
0 comentarios
Ver también
Categorías
Más información sobre Windows en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!