The diffusion is simulated as set of points with random step each frame of time. Looks like brownian motion.
Step of point can be estimated from diffusion equation:
dt - time step
D - diffusion coefficient
dx - step of point
Great program. I modified the code to allow showing the tracks of two particles: https://www.mathworks.com/matlabcentral/fileexchange/67581-2d-diffusion-simulator-with-particle-track-option
Is there a guide for the code?