help solving a differential equation
Afficher commentaires plus anciens
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!
Réponses (1)
Walter Roberson
le 15 Nov 2019
>> 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.
Catégories
En savoir plus sur Ordinary Differential Equations dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!