Since this sounds like a homework assignment, if you show us what you've written to try to solve the problem and ask a specific question about where you're having difficulty we may be able to offer some guidance.
If this isn't a homework assignment, just use the ODE solvers included in MATLAB, like ode45. Or if it is a homework assignment, use the results from ode45 to check your function's answer.
