S=[]; for (i=0;i<20;i++){ for (j=0;j<20;j++){ q=(i-10)*p*e*d/10; r=(j-10)*p*e*d/10; if (Math.exp(-(q*q+r*r)/(2*theV))/(2*Math.PI*theV)>0.01) { S.push([q,r,Math.exp(-(q*q+r*r)/(2*theV))/(2*Math.PI*theV)]); } } S.push([NaN,NaN,NaN]); }; S