0

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?

Jared Lo
  • 229
  • 1
  • 9
  • We cannot reproduce your problem because Do is not defined. – Bentoy13 Aug 28 '19 at 08:34
  • sorry, I have updated the examples with the value of Do – Jared Lo Aug 28 '19 at 08:51
  • `time` has not the right size; change it to `time=1:dt:N*dt` for example. – Bentoy13 Aug 28 '19 at 09:00
  • I run the code, I get `vx_Sim=-8.2e-10` and `DDeffSim=-9.1e-10`. Seems to me the same result, taking into account numerical approximations. So what is the problem? – Bentoy13 Aug 28 '19 at 09:01
  • so theoretically vx=0 which is right compared to the simulations, but DDeff should equal 1. – Jared Lo Aug 29 '19 at 01:16
  • So your error lies in the computation of `XM`, check with the original formula. As I said, I can't help you more because I dont know anything about this subject. – Bentoy13 Aug 29 '19 at 06:55

1 Answers1

0

so the effective diffusion coefficient is related to the variance of my ensemble of vectors, so I used the Matlab function var() to compute the diffusion.

DDeffsim=mean(var(wn).')'./(2*dt)/NT;
Jared Lo
  • 229
  • 1
  • 9