How would I enter the Differential Equation y''+100y=2sin(4t)

1 visualización (últimos 30 días)
Andrew Serrano
Andrew Serrano el 5 de Mayo de 2019
Respondida: Star Strider el 5 de Mayo de 2019
the correct answer should be C1cos10t + C2sin10t + (1/42)sin4t
I tried this code and got a crazy answer.
dsolve ('D2y+100*y=2*sin(4*t)','t')
ans =
(3*sin(8*t)*((6*cos(4*t))/35 + (2*cos(8*t))/35 + 11/105))/8 - (sin(4*t)*((6*cos(4*t))/35 + (2*cos(8*t))/35 + 11/105))/8 - (3*sin(12*t)*((6*cos(4*t))/35 + (2*cos(8*t))/35 + 11/105))/8 + (sin(16*t)*((6*cos(4*t))/35 + (2*cos(8*t))/35 + 11/105))/8 + sin(10*t)*(cos(6*t)/60 - cos(14*t)/140) + C9*cos(10*t) - C10*sin(10*t)

Respuestas (2)

Omer N
Omer N el 5 de Mayo de 2019
Try like so:
syms y(t)
simplify( dsolve(diff(y,2)+100*y==2*sin(4*t),t) )
ans =
sin(4*t)/42 + C1*cos(10*t) - C2*sin(10*t)

Star Strider
Star Strider el 5 de Mayo de 2019
Use the simplify function:
syms t y(t) Dy0 y0
Dy = diff(y);
D2y = diff(y,2);
Eqn = D2y + 100*y == 2*sin(4*t);
ys = dsolve(Eqn, Dy(0)==Dy0, y(0)==y0);
ys = simplify(ys, 'Steps',50)
producing:
ys =
sin(4*t)/42 - sin(10*t)/105 + y0*cos(10*t) + (Dy0*sin(10*t))/10
I specified the initial conditions here, so they will appear as ‘y0’ and ‘Dy0’ in the integrated equation.

Categorías

Más información sobre Solver Outputs and Iterative Display 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!

Translated by