Matlab understanding ode solver -
i have system of linked differential equations solving ode23 solver. when threshold reached 1 of parameters changes reverses slope of function.
i followed behavior of ode debugging function , noticed starts jump in "time" around point. generates more data points.however, these not represented in final solution vector.
can explain behavior, why not calculated values find way solution vector?
//edit: clarify, behavior starts when v changes 0 other value. (when write every value of v vector has more 1000 components while ode solver solution has ~300).
find code of equations below:
%chemostat model, based on: %dcc=-v0*cc/v + umax*cs*cc/(ks+cs)-rd %dcs=(v0/v)*(cs0-cs) - cc*(ys*umax*cs/(ks+cs)-m) function dydt=systemequationsribose(t,y,funv0ribose,v,umax,ks,rd,cs0,ys,m) v=funv0ribose(t,y); %funv0ribose determines v dependent on y(1) if y(2)<0 y(2)=0 end dydt=[-(v/v)*y(1)+(umax*y(1)*y(2))/(ks+y(2))-rd; (v/v)*(cs0-y(2))-((1/ys)*(umax*y(2)*y(1))/(ks+y(2)))];
thanks in advance!
cheers, dahlai
the first conditional can expressed as
y(2) = max(0, y(2)).
as 1 can see, still continuous function, kink, i.e., discontinuity in first derivative. 1 can interpret point curvature radius 0
, i.e., infinite curvature.
ode23
uses order 2 method integrate, order 3 method estimate error , order 1 euler step estimate stiffness.
an integration step on kink renders discretization errors order 1 (or 2, depending on convention), confounding logic of step size control. forces rather radical step-size reduction, since small step falls, probably, short of kink, correct orders found again, resulting in step-size increase in next step again go on kink etc.
the return array contains successful integration steps, not failed attempts of step-size control.
Comments
Post a Comment