How to solve coupled second order ODE?

3 ビュー (過去 30 日間)
Juan Pedro Martinez
Juan Pedro Martinez 2022 年 9 月 26 日
回答済み: Torsten 2022 年 9 月 26 日
Hello, I want to solve this system of equations (body falling with air resistance) to be able to blot x and y.
With initial conditions:
Does anyone have any pointers? Reading the documentation seems I need to write them as first order equations, but as I do not have de explicit function, I don't know how to obtain x and y.
Thank you!
  2 件のコメント
Torsten
Torsten 2022 年 9 月 26 日
Initial conditions ?
Juan Pedro Martinez
Juan Pedro Martinez 2022 年 9 月 26 日
Hello, thanks for your reply. You are right, I was jsut focusing on programming and forgot the math. I edited the question so the information is visible.

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

回答 (1 件)

Torsten
Torsten 2022 年 9 月 26 日
b = 0.1;
fun = @(t,y)[y(2);-b*y(2)*sqrt(y(2)^2+y(4)^2);y(4);-b*y(4)*sqrt(y(2)^2+y(4)^2)];
y0 = [0;44.5;80;0];
tspan = [0,10];
[T,Y] = ode45(fun,tspan,y0);
plot(T,[Y(:,1),Y(:,3)])

カテゴリ

Help Center および File ExchangeProgramming についてさらに検索

タグ

製品


リリース

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by