dsolve function returning empty sum

1 次查看(过去 30 天)
Following is the code to solve ode 2nd order ODE d^2y/dt^2+y=0; y(0)=1; y'(0)=0;
I find that the following code works
dsolve('D2y+y=0','y(0)=1','Dy(0)=0')
and it does not work when following code is executed(very equivalent of above code), returns empty sum
syms y(t)
eqn= diff(y,t,2)+ y ==0;
dsolve(eqn,'y(0)=1','Dy(0)=0')
Any idea, sure I did not understand something.

采纳的回答

Walter Roberson
Walter Roberson 2019-3-10
syms y(t)
dy = diff(y,t);
eqn = diff(y, t, 2) + y == 0;
dsolve(eqn, y(0)==1, dy(0)==0)

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Symbolic Math Toolbox 的更多信息

产品

Community Treasure Hunt

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

Start Hunting!

Translated by