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

조회 수: 12 (최근 30일)
Noah Wilson
Noah Wilson 2019년 12월 8일
편집: Stephan 2019년 12월 8일
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.

채택된 답변

Stephan
Stephan 2019년 12월 8일
편집: Stephan 2019년 12월 8일
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))

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Programming에 대해 자세히 알아보기

제품


릴리스

R2019a

Community Treasure Hunt

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

Start Hunting!

Translated by