How to numerically integrate the planar equations of motion?
8 views (last 30 days)
Show older comments
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 Comments
Answers (2)
John D'Errico
on 20 Jun 2022
Edited: John D'Errico
on 20 Jun 2022
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.
See Also
Categories
Find more on Earth and Planetary Science in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!