I have 2 coupled non linear 2nd order ODEs which describe a particle's trajectory in space, subject to an initial horizontal and vertical velocity, and also to gravitational and aerodynamic forces.
$x$ is the horizontal displacement. $y$ is the vertical displacement. $\beta$ is a negative constant. $\gamma$ is a negative constant.
$\ddot{x} = \beta(\dot{x}^2 + \dot{y}^2)\cos(\tan^{-1}(\dot{y}/\dot{x}))$
$\ddot{y} = \beta(\dot{x}^2 + \dot{y}^2)\sin(\tan^{-1}(\dot{y}/\dot{x})) + \gamma$
Initial conditions are:
$\dot{x}(0) = V_0\cos(\alpha_0)$
$\dot{x}(0) = V_0\sin(\alpha_0)$
For the sake of argument, $V_0$ and $\alpha_0$ are both known constants.
What I would like to do, is use MATLAB to plot the trajectory of this particle, i.e plot $y$ against $x$.
My first attempt was to convert this to a first order ODE, which I did successfully by setting $a = \dot{x}$ and $b = \dot{y}$. I substituted these into the ODEs, and used ode45 to solve for $\dot{x}$ and $\dot{y}$ and plot for the time $t = 0$ to $t = 5$. However, this just shows the component velocities, and not displacement, or position. I know mathematically I would just integrate and use two more initial conditions ($x(0)=y(0)=0$), but programmatically I don't know how to do this. If anyone could shed some light I'd be grateful. This way I can also see when the $y$ displacement returns to zero (when the particle hits the ground).