00001 /* Copyright Inria/Enpc */ 00002 00003 /********************************************* 00004 * argument function 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 * Example: 00018 * call this ext5 routine: 00019 * ode([1;0;0],0,[0.4,4],'ext9c') 00020 * ================================ 00021 * With dynamic link: 00022 * -->link('ext9c.o','ext9c','C') 00023 * -->ode([1;0;0],0,[0.4,4],'ext9c') 00024 *********************************************/ 00025 00026 int ext9c(int *n, double *t, double *y, double *ydot) 00027 { 00028 ydot[0] = y[0] * -.04 + y[1] * 1e4 * y[2]; 00029 ydot[2] = y[1] * 3e7 * y[1]; 00030 ydot[1] = -ydot[0] - ydot[2]; 00031 return(0); 00032 } 00033 00034 00035
1.5.1