How would I enter the Differential Equation y''+100y=2sin(4t)
2 次查看(过去 30 天)
显示 更早的评论
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)
0 个评论
回答(2 个)
Omer N
2019-5-5
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)
0 个评论
Star Strider
2019-5-5
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.
0 个评论
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!