Keep the negative value while squaring

7 views (last 30 days)
Acc_Rocket(t) = (Thrust - weight - drag*Velocity(t)^2)./mass;
when the velocity is negative, the drag should be positive, but squaring the velocity makes the drag negative again, is there a way to make the velocity value keep its negative sign even when squared.

Accepted Answer

James Tursa
James Tursa on 2 Mar 2020
Change this
Velocity(t)^2
to this
abs(Velocity(t)) * Velocity(t)

More Answers (0)

Categories

Find more on Statics and Dynamics in Help Center and File Exchange

Tags

Products

Community Treasure Hunt

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

Start Hunting!