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!

回答(1 个)

Walter Roberson
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.

类别

Help CenterFile Exchange 中查找有关 Ordinary Differential Equations 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by