Solvers for first order ODEs, including ode45, can be easily accommodated to solve systems of ODEs. When solving a second order ODE, the equation is first transformed to a system of two first order ODEs, which is then numerically approximated by the ODE solver (ode45 in this case).
It is based on State variable Technique, based on the Principle that an n-th order differential equation can be represented by means of n first order differential equations in Matrix Form as used in control system.