I want to simulate the underlying stochastic process of diffusion on a microscopic level and compare the result with the solution of the heat equation. However, I'm not able to match the solution of the heat equation with my computed quantities, as I'm not able to figure out the correct time scale, spatial scale and diffusion coefficient.
Consider the following algorithm in pseudo code.
Position = [0,0,0,0,...] // place particles initially at origin
// The format is [x1,y1,x2,y2,...]
for t=1:numberTimeSteps
for i = 1:numberParticles
alpha = uniform random number in [ 0, 2pi];
steplength = normal random number with mean 0 and stdv S
xi += sin(alpha)*steplength
yi += cos(alpha)*steplength
end
end
Now I have a vector of positions of all my particles. To compute the density, I count all particles that are inside a domain $[-L,L]$, which I divide into cells (i.e. I compute a histogram).
histo = zeros(Nhist,Nhist)
for i = 1 :numberParticles
idx = SomeFunc(xi) // compute the index corresponding to position x
idy = SomeFunc(yi) // same for y
histo[idy][idx] +=1
end
histo = histo / numberParticles
Now I have a 2D histogram which roughly looks like the following picture.

Due to symmetrie, I now only consider the cross-section through the image. I know (or I hope to know, actually I'm not sure if this is the correct formula), that the density for a dirac impulse can be computed in 2D as \begin{align} u(x,t) = \frac{1}{(4\pi D t)^{dim/2}} exp(-x^2/(4Dt)) \end{align} where $u(x,t)$ solves the 2D heat equation on an unbounded domain $u_t = Du_{xx}$.
Now, for a large number of particles, my statistical computation should approach the analytic solution. However, I don't know how to derive $D$ from my computation. Also, I'm not sure about $x$ and $t$, as you can see in the next picture (where I apparently take the wrong values).

So here is my question:
What analytic function with which parameters will match the computed densities from my random walk approach. How does my simulation translate into the physical framework of the heat equation.
Thank you very much!