How to solve coupled (differential) equations of motion using matlab?

12 visualizzazioni (ultimi 30 giorni)
I am trying to solve three equations of motion and then plot the displacement in 3-D but am having trouble figuring out how to do this through Matlab. The equations of motion are the following:
(1) m*x''(t) = -b*x'(t)
(2) m*y''(t) = -w*z'(t) - b*y'(t)
(3) m*z''(t) = w*y'(t) - b*z'(t) - mg
Intial conditions:
x'(0) = v_xo
y'(0) = 0
z'(0) = v_zo
These equations describe the trajectory of a soccer ball under the influence of drag and the magnus force so I am hoping to also plot the resulting trajectory in a three dementional plot. Thank you for your help if you are able to help I greatly appreciate it as I have been stuck on this problem for months now.

Risposta accettata

Stephan
Stephan il 8 Dic 2019
Modificato: Stephan il 8 Dic 2019
Whta is the problem? There is an analytical solution (here assumed that vx0 and vz0 are equal to 1):
syms w b g m x(t) y(t) z(t)
assume([w, b, g, m],'real')
Dx = diff(x,t);
Dy = diff(y,t);
Dz = diff(z,t);
eq(1) = m*diff(x,t,2) == -b*Dx;
eq(2) = m*diff(y,t,2) == -w*Dz - b*Dy;
eq(3) = m*diff(z,t,2) == w*Dy - b*Dz - m*g;
conds = [Dx(0)==1, Dy(0)==0, Dz(0)==1, x(0)==0, y(0)==0, z(0)==0];
[solx, soly, solz] = (dsolve(eq,conds))

Più risposte (0)

Categorie

Scopri di più su Programming in Help Center e File Exchange

Prodotti


Release

R2019a

Community Treasure Hunt

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

Start Hunting!

Translated by