% Generate an approximate Poisson process of time length T (in whatever dimensions you want) % with rate r and binsize dt (measured in the same dimensions as T). % P=Poisson(r,T,dt) function p = Poisson(r,T,dt) % n is the number of bins (the size of the returned vector) n=T/dt; % c is the probability that a single bin will contain a spike c=r*dt; % This is a vectorized command for generating the process p=rand(1,n)