Solving coupled 2nd order ODEs

15 ビュー (過去 30 日間)
OJAS POTDAR
OJAS POTDAR 2021 年 7 月 18 日
コメント済み: OJAS POTDAR 2021 年 7 月 28 日
Hi,
I am trying to solve coupled 2nd order ODEs. When one consider quadratic air resistance, equations of motion of a projectile take the form:
mx"=-cx'(sqrt(x'^2+y'^2))
my"=-mg-cy'(sqrt(x'^2+y'^2))
where x is horizontal distance and y is vertical distance.
Can this be done in Matlab? I understand, I can reduce one second order ODE to a series of first order ODEs, but how to address coupled part i.e. x'' depends on y' and y'' depends on x'.
Thanks
  2 件のコメント
Torsten
Torsten 2021 年 7 月 18 日
x1' = x2
x2' = -c*x2*sqrt(x2^2+x4^2)/m
x3' = x4
x4' = -g -c*x4*sqrt(x2^2+x4^2)/m
where x1 is horizontal distance, x2 is horizontal velcocity, x3 is vertical distance and x4 is vertical velocity.
Now you can use one of the ODE solvers (ODE45, ODE15S).
OJAS POTDAR
OJAS POTDAR 2021 年 7 月 28 日
Thanks. This worked nicely:
function dydt = CatchAPass(t,y,C)
dydt = zeros(4,1);
dydt(1)= y(2);
dydt(2)= -C*y(2)*sqrt(y(2)^2+y(4)^2);
dydt(3)= y(4);
dydt(4)= -9.8-C*y(4)*sqrt(y(2)^2+y(4)^2);

サインインしてコメントする。

回答 (0 件)

カテゴリ

Help Center および File ExchangeOrdinary Differential Equations についてさらに検索

製品


リリース

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by