I'm having a problem with the events locator in Matlab. I'm looking at a coupled ODE which represents two interfaces going unstable. I have no problems solving it, all I'm trying to do is find the radius (R_2v
) when a certain amplitude (10^2
) is reached for each interface. Av
is a matrix of two column vectors, which are the radial (or time) evolutions of the amplitudes of the two interfaces.
The problem being reported is 'Nonscalar arrays of function handles are not allowed; use cell arrays instead.'
n.b. 2
, mu_2_0
, mu_2_f
, R_gel
, and V
are all parameters for funsys
options = odeset('Events',[@eventsA,@eventsB]);
[R_2v,Av,R_2Ae,Ae,Aie,R_2Be,Be,Bie] = ode15s(@funsys_back_Vg1,[1 R_max],[1;1],options,2,mu_2_0,mu_2_f,R_gel,V);
function [valueA,isterminalA,directionA] = eventsA(R_2v,Av)
valueA = Av(1) - 10^2;
isterminalA = 0;
directionA = 0;
function [valueB,isterminalB,directionB] = eventsB(R_2v,Av)
valueB = Av(2) - 10^2;
isterminalB = 0;
directionB = 0;