# okay - here is how to do the correlations part # for probelm 1 chapt 2 using XPP # step 1 do the simulation ch2ex1.ode # pull up the data browser # click on "Table" and save "R" in a file R.tab, with xlo=0,xhi=1000 # Make a table for "stim" in s.tab as well with xlo=0,xhi=1000 # run this ODE file # # reads in the two columns table r R.tab table s s.tab # periodizes them rr(x)=r(mod(x,1000)) ss(x)=s(mod(x,1000)) # set up an iteration @ meth=discrete,total=25 # set up some plots @ nplots=2,xp=k,yp=q,yp2=dval @ xlo=-1,xhi=25,ylo=-1,yhi=.5 # init k=-1,q=0 # here is the iteration k'= k+1 # here is the cross correlation divided by sig^2 q'= sum(0,1000)of(ss(i')*rr(i'+k))/10000 # here is original function d(t)=-cos(2*pi*(t-20)/140)*exp(-t/60) # and its plot aux dval=d(k*10) done