Can i influence the 'y' during an ode45 at a certain event?
I want to let the ODE45 stop at a certain event, manipulate the result at that timepoint and let it run further using the manipulated result as initial condition.A basic example is this:
spawnday=250;function [value,isterminal,direction] = half_y_at_event(t, y, spawnday) value = [t-spawnday]; isterminal = [1]; direction = []; endoptions=odeset('Events', @half_y_at_event, 'AbsTol', 1e-8, 'RelTol', 1e-8);[t1, y1, te, ye, ie] = ode45(@dget_y, [0 500], [y_0], options, [pars]);ye=ye/2;[t2, y2] = ode45(@dget_y, [0 500], [ye], options, [pars]);
Is there a possibility to combine both ODE45 into one?
Mergin the matrices later is not an option.
Best Answer