I want to pass additional parameters to the ode45 function in MATLAB. There are many questions already on this, but I also have a 'flag' argument in my function.
function [xdot,isterminal,dircn]=spp(t,x,flag,f)
Usually, while calling ode45, something like this would work if spp did not have a flag argument.
options=odeset('RelTol',1e-13,'AbsTol',1e-14,'events','on');
[t,x,te,xe,ie]=ode45(@(t,x)spp(t,x,f),[0 2*pi/OMEG],[xin;xdin],options);
I have searched around but cannot find the solution. Please help me out.