I have a system of ODE's. The ODE takes a couple of seconds to run in a particular parameter range. For another parameter range, however, MATLAB suddenly takes an infinite amount of time to run (well, ok, only tested to half a day).
This is a complex, multiply coupled ODE with hyperbolic functions; solving it analytically is impossible, solving it numerically would be a master's thesis, so I'm looking for a computational solution. I need to throw out such parameters and move to the next (random) set of parameters.
How would I debug or catch this semantic error in MATLAB? I'm just not sure what odesolver doesn't like about it. So far, I've used profiler to narrow it down to these lines in odesolver
:
f(:,2) = feval(odeFcn,t+hA(1),y+f*hB(:,1),odeArgs{:});
f(:,3) = feval(odeFcn,t+hA(2),y+f*hB(:,2),odeArgs{:});
f(:,4) = feval(odeFcn,t+hA(3),y+f*hB(:,3),odeArgs{:});
f(:,5) = feval(odeFcn,t+hA(4),y+f*hB(:,4),odeArgs{:});
f(:,6) = feval(odeFcn,t+hA(5),y+f*hB(:,5),odeArgs{:});\
(which is essentially the core solver method). Obviously the source of the error is my choice of parameters, but profiler
does not show any noticeable time taken up by my function (I pass a script function of the ODE as an anonymous function to ode45
).