I\'m trying to locate the locations of one of the equations in a system of differential equations in MATLAB.I\'m trying to use the Events propety of odeset.How do I pick out
Basically, looking at the documentation, if you're interested in looking at when x(3) = 0, then you need to rewrite your event function:
function [value,isterminal,direction] = event(t,x)
value = x(3); %I can't specify X(3,1) here --> why not?? Lorenz(t,x) is going to return the differential. That's not what you want
isterminal = 0;
direction = 0; %The desired directionality should be "Detect all zero crossings"
end
Now I don't know how you defined I
in
[t x tm xm ie] = ode45(@Lorenz,[0 200],I,options);
But your solution to the equation is very stable around a few points and you may only see one zero crossing if x(3) at time zero is negative.
[t x tm xm ie] = ode45(@khal,[0 5],[10 -1 -20],options);
tm =
0.1085