LJ Archive

Listing 1. ODE Listing


> \cat int.r | pr -t -n:2 -
 1:vdpol = function ( t , x )
 2:{
 3:  global (mu)
 4:  xd[1] = x[1] * mu*(1-x[2]^2) - x[2];
 5:  xd[2] = x[1];
 6:  return xd;
 7:};
 8:
 9:mu = 0.1;
10:t0 = 0; tf = 30; dt = 0.011;
11:x0 = [-5; 5];
12:
13:tic();
14:out = ode( vdpol, t0, tf, x0, dt );
15:printf("ODE time: %10.3f\n", toc());
LJ Archive