ext10c.c

Go to the documentation of this file.
00001 /* Copyright Inria/Enpc */
00002 
00003 /*********************************************
00004  *     external fonction for ode 
00005  *     input variables n, t, y 
00006  *     n = dimension of state vector y 
00007  *     t = time 
00008  *     y = state variable 
00009  *     output variable = ydot 
00010  *    ================================
00011  *     external routine must 
00012  *     load ydot[0] with d/dt ( y(1)(t) ) 
00013  *          ydot[1] with d/dt ( y(2)(t) ) 
00014  *          ... 
00015  *     i.e. ydot vector of derivative of state y 
00016  *    ================================
00017  *     With dynamic link: 
00018  *     link('ext10c.o','ext10c','C') 
00019  *    ================================
00020  *     passing a parameter to ext6 routine by a list: 
00021  *     -->param=[0.04,10000,3d+7]; 
00022  *     -->y=ode([1;0;0],0,[0.4,4],list('ext10c',param)) 
00023  *     param is retrieved in ext6 by: 
00024  *     param[0]=y[ *n ] , param[1]=y[ *n + 1] etc 
00025  *     with this calling sequence y is a n+np vector 
00026  *     where np=dimension of scilab variable param 
00027  *********************************************/
00028 
00029 int ext10c(int *n, double *t, double *y, double *ydot)
00030 {
00031   static double param[3];
00032   param[0] = y[*n + 0];
00033   param[1] = y[*n + 1];
00034   param[2] = y[*n + 2];
00035   ydot[0] = -param[0] * y[0] + param[1] * y[1] * y[2];
00036   ydot[2] = param[2] * y[1] * y[1];
00037   ydot[1] = -ydot[0] - ydot[2];
00038   return(0);
00039 } 
00040 

Generated on Sun Mar 4 15:03:57 2007 for Scilab [trunk] by  doxygen 1.5.1