The spreading solution to the one-dimensional diffusion equation that we verified can also be obtained by treating the motion of a molecule as a series of independent steps either to the right or to the left along the x axis.Figure 4.24 in IPMB shows a simulation of a two-dimensional random walk that Russ added to the second edition.
Note how the particle wanders around one region of space and then takes a number of steps in the same direction to move someplace else. The particle trajectory is “thready.” It does not cover space uniformly. A uniform coverage would be very nonrandom. It is only when many particles are considered that a Gaussian distribution of particle concentration results.I thought readers would profit from seeing the results of several simulations, so they won’t draw too many conclusions from one sample. Also, why let Russ have all the fun? So I wrote this MATLAB code, where “rand” is a random number generator with output between zero and one.
MATLAB code to perform a two-dimensional random walk. |
The particle trajectory for nine samples of a two-dimensional random walk, each with 40,000 steps. |
The average distance of the particle from the starting point as a function of the number of steps, for a two-dimensional random walk. |
No comments:
Post a Comment