Difference between revisions of "Matlab: Simulating Brownian motion"
From Course Wiki
(Created page with '{{Template:20.309}} =Introduction= This exercise shows how to simulate the motion of single and multiple particles in one and two dimensions using Matlab. You will discover some…') |
|||
(2 intermediate revisions 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 17: | 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. | ||
− | < | + | <code> |
N = 1000; | N = 1000; | ||
displacement = randn(1,N); | displacement = randn(1,N); | ||
plot(displacement); | plot(displacement); | ||
− | </ | + | </code> |
==Distribution of Displacements== | ==Distribution of Displacements== | ||
Line 566: | Line 562: | ||
</pre> | </pre> | ||
{{Template:20.309 Bottom}} | {{Template:20.309 Bottom}} | ||
+ | --> |