This example simulates a baseball (particle Q) hit from home plate (point No) over flat Earth (Newtonian Frame N). Variables x and y are the Nx> (horizontally-right) and Ny> (vertically-upward) measures of Q's position from No.
Mass of baseball m = 145 g (5.1 ozm)
Gravity force is -m*g*Ny>
where g = 9.8 m/s^2
Aerodynamic drag is -b*v
where v is Q's velocity.
With air resistance b = 0.05 N*s/m whereas
without b = 0.
This example uses air density, cross-sectional area, and the coefficient of drag to simulate a baseball traveling through air.
Modify the MotionGenesis™ script
so it writes a MATLAB® .m file that takes coefDrag as an input argument.
Next, modify the .m file so it detects the instant the ball hits the ground.
To use MATLAB® event handling, create a modified MotionGenesis script.