How to numerically integrate the planar equations of motion?
5 ビュー (過去 30 日間)
古いコメントを表示
For example, i have this equation for deacceleration
Written in MATLAB as dV/dt = -(rho*V^2)/(2*B) - g0*sin(gamma)
B (constant), rho, and gamma are all defined variables.
I am trying to use ode45, but can not get this to be a valid funtion to even use ode45. Below is my input and error I am getting.
dVdt = @(t,V), -(rho*V^2)/(2*B) - g0*sin(gamma)
Error: Invalid expression. Check for missing or extra characters
Any suggetions on how to approch this problem correctly would be greatly apprciated.
0 件のコメント
回答 (2 件)
John D'Errico
2022 年 6 月 20 日
編集済み: John D'Errico
2022 年 6 月 20 日
You need to learn how to write a function handle. What you wrote was incorrect syntax. Do you see the spare comma, AFTER the parens?
dVdt = @(t,V), -(rho*V^2)/(2*B) - g0*sin(gamma)
Instead, this next is valid MATLAB syntax:
dVdt = @(t,V) -(rho*V^2)/(2*B) - g0*sin(gamma);
I added a semi-colon at the end. Learn to do that, although it is not crucial. The semi-colon stops lots of crap being dumped to your command widow.
参考
カテゴリ
Help Center および File Exchange で Earth and Planetary Science についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!