Scilab Function

odedc - discrete/continuous ode solver

Calling Sequence

yt=odedc(y0,nd,stdel,t0,t,f)

Parameters

Description

y=odedc([y0c;y0d],nd,[h,delta],t0,t,f) computes the solution of a mixed discrete/continuous system. The discrete system state yd_k is embedded into a piecewise constant yd(t) time function as follows:

yd(t)=yd_k for t in 
[t_k=delay+k*h,t_(k+1)=delay+(k+1)*h[ (with delay=h*delta).
   

The simulated equations are now:

dyc/dt=f(t,yc(t),yd(t),0),  for t in [t_k,t_(k+1)[
yc(t0)=y0c
   

and at instants t_k the discrete variable yd is updated by:

yd(t_k+)=f(yc(t_k-),yd(t_k-),1)
   

Note that, using the definition of yd(t) the last equation gives

yd_k = f (t_k,yc(t_k-),yd(t_(k-1)),1)  (yc is time-continuous: yc(t_k-)=yc(tk))
   

The calling parameters of f are fixed: ycd=f(t,yc,yd,flag); this function must return either the derivative of the vector yc if flag=0 or the update of yd if flag=1.

ycd=dot(yc) must be a vector with same dimension as yc if flag=0 and ycd=update(yd) must be a vector with same dimension as yd if flag=1.

t is a vector of instants where the solution y is computed.

y is the vector y=[y(t(1)),y(t(2)),...]. This function can be called with the same optional parameters as the ode function (provided nd and stdel are given in the calling sequence as second and third parameters). In particular integration flags, tolerances can be set. Optional parameters can be set by the odeoptions function.

An example for calling an external routine is given in directory SCIDIR/default/fydot2.f

External routines can be dynamically linked (see link).

Examples

See Also