46
3 Biased Brownian Motion
%figure(2); plot(t,MEANeta); grid;
%figure(3); plot(t,MEANDMN); grid;
%figure(4); plot(t,MEANdw); grid;
3.7.5 Program 3.5, Rocking Ratchet, Matlab Code
%Rocking ratchets.
N=10000; NR=1000; dt=0.01;
Fload=0.0; Vo=8.; tau=0.4; D=5.; FDN=1.;
eta=zeros(N,NR);
raizdt=sqrt(2*D*dt);
x=zeros(N-1,NR);
V=zeros(N-1,NR);
dV=zeros(N-1,NR);
dw=raizdt*randn(N,NR);
for j=1:NR
for i=1:N-1
Pat1at = 0.5*(1. + exp(-i*dt/tau)); % Probability to stay in (-1)
Pat2at1 = Pat1at;
Pat1bt = 0.5*(1. - exp(-i*dt/tau)); % Transition Probability (1) to (-1)
Pat2bt1 = Pat1bt;
Pbt2bt1 = 0.5*(1. + exp(-i*dt/tau)); % Probability to stay in (1)
Pbt1bt = Pbt2bt1;
Pbt1at = 0.5*(1. - exp(-i*dt/tau)); % Transition Probability (-1) to (1)
Pbt2at1 = Pbt1at;
R=unifrnd(0,1);
if(Pat1at R)
eta(i+1,j)=-1.;
else eta(i+1,j)=1.;
end
if(Pat1at ≺ R || Pat1at R )
R1=unifrnd(0,1);
elseif(Pat2bt1 R1 || Pat2at1 R1)
eta(i+2,j)=-1.;
else eta(i+2,j)=1.;
end
end
end
for j=1:NR;
for i=1:N-1;
xij=x(i,j);
dV(i,j)=(cos(2.*pi*xij) - 0.5*cos(4.*pi*xij));%tilted to the right
Précédent

- 57/198

Suivant