I need to compute the drift velocity ( v=d/dt[r(t)] ) and the effective diffusion coefficient (Deff=d/dt[r(t)^2]-d/dt[r(t)]^2 ) from random trajectories for the case of Brownian motion over a periodic potential.
As a mere example assume I have an ensemble of random trajectories:
dt=1e-2; N=1e6; Ensemble=200; Do=1;
wn=sqrt(2*Do*dt)*normrnd(0,1,[Ensemble,N]);
time=0:dt:N*dt;
I first compute the drift velocity:
P2 = polyfit(time,mean(wn(:,:)-wn(:,1)),1);
vx_Sim=P2(1);
which gives me the expected value of the analytic solution. Then I compute the effective diffusion like:
XM=mean((wn(:,:)-wn(:,1)).^2,1)/(2*Do);
P =polyfit(time,sqrt(XM),1);
DDeffSim=P(1);
yet I don't get back the expected result from the analytic solutions for the particular Brownian motion I'm studying. Am I calculating this wrong?