/* rros.c * * either chaotic Roessler oscillators or * undamped harm. osc. with reset; * various coupling structures * */ # include # include /* always include this */ # include /* matrix and vector math. */ # include /* random numbers are used */ # include /* Runge-Kutta */ # define ROSSLER 1 // set this to 1 if you wand Roessler oscillators // otherwise undamped harmonic oscill. with reset are used /* * * define simulation variables and parameters * */ # define STEPSIZE .01 float t; # define N 64 /* number of units */ # define n 3 /* order of diff.system */ Vector domega; Vector x; /* x1 ... xN, y1 .... yN, z1 .... zN */ Vector dxdt; /* derivatives */ Matrix J; /* connections (if not meanfield couplings) */ /* diffusive or random .... */ Vector cfields; /* coupling fields; either meanfield or diffusive or random connectivity */ float xx1, yy1; SwitchValue smean = ON; /* mean field coupling */ SwitchValue sdiffusive = OFF; /* diffusive coupling */ SwitchValue swrand = OFF; /* random connections */ SliderValue somega = 1000; SliderValue sdelomega = 100; SliderValue sepsilon = 100; SliderValue sa = 150; BEGIN_DISPLAY SWITCH( "mean", smean ) SWITCH( "diffusive", sdiffusive ) SWITCH( "random", swrand ) SLIDER( "mean omega", somega, 500, 1500) SLIDER( "delta omega", sdelomega, 0, 500) SLIDER( "coupling strength", sepsilon, 0, 500) SLIDER( "a", sa, 0, 500) WINDOW("signals") RASTER( "x", AR, AC, x, VECTOR, N, 0, 0.0, 1.0, 2) WINDOW("MF-xy-plot") /* yy1 DOESNT WORK ?????????? */ PLOT("x-y", AR, AC, &xx1, VECTOR, 1, 0, 0, 0, -20., 20., &yy1, VECTOR, 1, 0, 0, 0, -20., 20., 2 ); WINDOW("xy-plot") PLOT("x-y", AR, AC, x, VECTOR, N, n, 0, 0, -20., 20., x, VECTOR, N, n, 0, 1, -20., 20., 2 ); WINDOW("x(t)") GRAPH( "x1", AR, AC, x, VECTOR, N, 0, 0, 0, -20, 20 ) GRAPH( "x2", AR, NC, x, VECTOR, N, 0, 1, 0, -20, 20 ) GRAPH( "y1", NR, C0, &x[N], VECTOR, N, 0, 0, 0, -20, 20 ) GRAPH( "y2", AR, NC, &x[N], VECTOR, N, 0, 1, 0, -20, 20 ) GRAPH( "z1", NR, C0, &x[2*N], VECTOR, N, 0, 0, 0, 0., 20 ) GRAPH( "z2", AR, NC, &x[2*N], VECTOR, N, 0, 1, 0, 0., 20 ) WINDOW("MF") GRAPH( "x1", AR, AC, &xx1, VECTOR, 1, 0, 0, 0, -20., 20.) GRAPH( "x2", AR, NC, &yy1, VECTOR, 1, 0, 0, 0, -20., 20.) END_DISPLAY NO_OUTPUT int main_init() { SET_STEPSIZE( STEPSIZE ) randomize( time(NULL) ); J = Get_Matrix(N,N); x = Get_Vector(N*n); dxdt= Get_Vector(N*n); domega = Get_Vector(N); cfields = Get_Vector(N); } int init() { int i; Clear_Vector(N, domega); Clear_Vector(N, cfields); Clear_Vector(N*n, x); Clear_Vector(N*n, dxdt); t = 0.0; for (i=0 ; i