help solving a differential equation
1 次查看(过去 30 天)
显示 更早的评论
Hey guys.
I want to solve differential equation that is connected to a pysical problem. The gist of it is that the position of a ball is 0 at 0 second. The velocity is v0 when t=0. The equation is : x''-x*ω^2=0. My problem is, that I don't know, how could I force matlab to write ω instead of any number?
Thank you in advance!
0 个评论
回答(1 个)
Walter Roberson
2019-11-15
>> syms x(t) omega
>> dx = diff(x)
dx(t) =
diff(x(t), t)
>> d2x = diff(dx)
d2x(t) =
diff(x(t), t, t)
>> eqn = d2x - dx*omega^2 == 0
eqn(t) =
- diff(x(t), t)*omega^2 + diff(x(t), t, t) == 0
>> dsolve(eqn)
ans =
C1 + C2*exp(omega^2*t)
>> dsolve(eqn, dx(0) == 0, x(0) == 0)
ans =
0
Yup. Without initial velocity, the ball just stays where it is.
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Ordinary Differential Equations 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!