The value of "y" (the "state" input to "derivative") is going infinite or NaN at some point. I'd suggest creating a helper function that calls derivative, and use the helper function as the ode45 function. Then you can either add some printout statements or insert a breakpoint so you can see when the state is going infinite and possibly why.
-Cam