Difference between revisions of "Matlab: Simulating Brownian motion"

From Course Wiki
Jump to: navigation, search
(Introduction)
 
(One intermediate revision by one user not shown)
Line 1: Line 1:
 +
<!--
 
{{Template:20.309}}
 
{{Template:20.309}}
 
=Simulating Single Particle Trajectories=
 
=Simulating Single Particle Trajectories=
  
This exercise shows how to simulate the motion of a single particle in one and two dimensions .
+
This exercise shows how to simulate the motion of a single particle in one and two dimensions.
  
 
==One Dimensional Brownian Motion==
 
==One Dimensional Brownian Motion==
Line 12: Line 13:
 
The first step in simulating this process is to generate a vector of random displacements. The commands to do this are shown below. N is the number of samples to generate.
 
The first step in simulating this process is to generate a vector of random displacements. The commands to do this are shown below. N is the number of samples to generate.
  
<pre>
+
<code>
 
N = 1000;
 
N = 1000;
 
displacement = randn(1,N);
 
displacement = randn(1,N);
 
plot(displacement);
 
plot(displacement);
</pre>
+
</code>
  
 
==Distribution of Displacements==     
 
==Distribution of Displacements==     
Line 561: Line 562:
 
</pre>
 
</pre>
 
{{Template:20.309 Bottom}}
 
{{Template:20.309 Bottom}}
 +
-->

Latest revision as of 21:28, 4 June 2015