Wir verwenden Cookies für grundlegende Funktionen, Statistik, Werbung, externe Medien (YouTube/Maps) und Google Fonts. Du kannst alle akzeptieren, nur notwendige oder Einstellungen wählen.
Originaldatei (SVG-Datei, Basisgröße: 335 × 720 Pixel, Dateigröße: 181 KB)
Diese Datei stammt aus Wikimedia Commons und kann von anderen Projekten verwendet werden. Die Beschreibung von deren Dateibeschreibungsseite wird unten angezeigt.
| BeschreibungRandomwalk msd.svg |
English: some trajectories and the mean squared displacement of a random walk with a step size of |
| Datum | |
| Quelle | Eigenes Werk |
| Urheber | Jkrieger |
| SVG‑Erstellung InfoField | |
| Quelltext InfoField | MATLAB code% timesteps in each random walk
timesteps=10000;
plotstep=10;
% diffusion coefficient for the random walk
D=0.5;
observation_radius=10;
observation_steps=100;
lim_factor=1.4;
plots=10;
plotevery=1;
%calculate grid size
dr=sqrt(2*D);
t=1:timesteps;
% simulate random walks on grid
x=zeros(plots,timesteps);
y=x;
for k=1:plots
for ct=2:timesteps
x(k,ct)=x(k,ct-1)+dr*(randi(2)-1.5)*2;
y(k,ct)=y(k,ct-1)+dr*(randi(2)-1.5)*2;
end
end
% calculate MSD as ensemble average on a logarihmic lag time scale
msdtau=round(logspace(0,floor(log10(timesteps)),50));
msd(1:length(msdtau))=0;
for tau=1:length(msdtau)
msd(tau)=mean( (x(:,msdtau(tau))-x(:,1)).^2 + (y(:,msdtau(tau))-y(:,1)).^2 );
end
% plot random walk
figure(1)
subplot(2,1,1)
for k=1:plotevery:plots
plot(x(k,1:plotstep:timesteps),y(k,1:plotstep:timesteps), 'Color', hsv2rgb([k/(plots+1),1,1]));
if (k==1)
hold on;
end
end
for k=5:5:length(msdtau)
drr=sqrt(msd(k));
rectangle('Position',[-drr,-drr,2*drr,2*drr], 'Curvature',[1,1], 'LineWidth', 2);
end
daspect([1,1,1])
hold off
xlim([-lim_factor*drr lim_factor*drr]);
ylim([-lim_factor*drr lim_factor*drr]);
xlabel('coordinate x');
ylabel('coordinate y');
title('random walk trajectories');
% plot MSD
subplot(2,1,2)
loglog(msdtau, msd, 'LineWidth', 2);
hold on
loglog(msdtau, 4*D*msdtau, 'r--', 'LineWidth', 2);
hold off
xlabel('lag time t')
ylabel('MSD \langle r^2(\tau)\rangle');
M{1}='measured MSD';
M{2}='\langle r^2(\tau)\rangle=4D\cdot\tau';
legend(M,'Location', 'NorthWest');
title('mean squared displacement');
xlim([1 1e4]);
ylim([1 1e4]);
daspect([1,1,1])
|
Klicke auf einen Zeitpunkt, um diese Version zu laden.
| Version vom | Vorschaubild | Maße | Benutzer | Kommentar | |
|---|---|---|---|---|---|
| aktuell | 14:44, 5. Aug. 2012 | 335 × 720 (181 KB) | wikimediacommons>Jkrieger | font problem solved |
Die folgende Seite verwendet diese Datei:
Wähle, welche Kategorien du zulassen möchtest. Notwendige Cookies sind immer aktiv.