The differential equation $\frac{d^2y}{dx^2} = my$ has two solutions $y = e^{\sqrt{m}x}$ and $y = e^{-\sqrt{m}x}$.
When I use ode45 (or any other IVP solver) in matlab, it always picks up $y = e^{\sqrt{m}x}$.
How do I make matlab pick the other solution, namely $y = e^{-\sqrt{m}x}$?
MATLAB does not pick $y = e^{\sqrt{m} x}$. Since $y_1 = e^{\sqrt{m} x}$ and $y_2 = e^{-\sqrt{m} x}$ are both solutions, then the solution is the linear combination of both namely $$y(x) = c_1 y_1(x) + c_2y_2(x)$$ Now, depending on the initial conditions you've passed ode45, $c_1,c_2$ will be adjusted accordingly.