Electromagnetic Wave MATLAB Library

Monte Carlo Simulation of Pair Distribution Function for Hard Spheres

Reference: Chapter 8 of Scattering of Electromagnetic Waves: Numerical Simulations

Home |Download


mcpdf.m generate random realizations of positions for hard spheres using the Monte Carlo method (also known as Metropolis shuffling). The pair distribution is computed by counting number of occurrences of pair separations.

Input Parameters


The figure below is generated with the following parameters (The PY results is generated using pypdf.m.)

ntot=200, fv=0.3, cnst=0.35, npsr=100, nrlz=30, seed=54321

Home | Top