ext12c.c

Go to the documentation of this file.
00001 /* Copyright Inria/Enpc */
00002 #include "stack-c.h"
00003 
00004 /****************************************
00005  *     same example with call to GetMatrixptr 
00006  *     param must be defined as a scilab variable 
00007  *     exemple with a call to matptr routine 
00008  *     -->param=[0.04,10000,3d+7];         
00009  *     -->link('ext12c.o','ext12c','C');     
00010  *     -->y=ode([1;0;0],0,[0.4,4],'ext12c') 
00011  *     *************************** 
00012  *     param entries are in stk(lp),stk(lp+1),stk(lp+2) 
00013  *     m,n = dimensions of param = 3,1 (or 1,3 if row v.) 
00014  *     (note that vector param not used in this example) 
00015  ****************************************/
00016 
00017 int ext12c(int *neq, double *t, double *y, double *ydot)
00018 {
00019   static int m, n, lp;
00020   GetMatrixptr("param", &m, &n, &lp);
00021   ydot[0] = - (*stk(lp)) * y[0] + (*stk(lp+1)) * y[1] * y[2];
00022   ydot[2] = (*stk(lp + 2)) * y[1] * y[1];
00023   ydot[1] = -ydot[0] - ydot[2];
00024   return 0;
00025 }

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