Diffusion at the Microscopic Level


Description

This MATLAB GUI simulates the random motion of M non-interacting particles on a grid. Each particle can only go up, down, left or right, with equal probability. All of the particles start their random walk from the origin, at the center of the box.

The plot on the left shows the position of all of the particles as time evolves. One of the particles is marked in blue, so that its random walk can easily be followed.

At the end of the simulation, the plot on the right shows the quantity ⟨L2⟩ as a function of N. Here, L is the distance between a particle and the origin after N steps (or equivalently after a time T = N δt, where δt is fixed), and the brackets indicate averaging over all of the particles.

How to use the GUI

Use the sliders to choose the number of particles, M, as well as the total number of steps, Nmax.

Click on the Go button to start the simulation. It will stop automatically after Nmax steps.

Download

To download the GUI, right click on each of the links below, and save the corresponding files into a directory. Set the MATLAB path to that directory and then type Diffusion at the MATLAB prompt.

Type help Diffusion at the MATLAB prompt if you need to be reminded of how to use the GUI.

GUI developed by Joceline Lega, Spring 2005.