Plot3D issue
- To: mathgroup at smc.vnet.net
 - Subject: [mg76302] Plot3D issue
 - From: Mathieu G <ellocomateo at free.fr>
 - Date: Sat, 19 May 2007 04:40:59 -0400 (EDT)
 
Hello, hello,
Does anyone have an idea how I can improve the quality of the 3D plots 
in the following example? It looks like the range affects the quality!:
(* ********** Code following ********** *)
Clear["Global`*"];
HoleSize = Rationalize[1.5 1*^-6 /2];
BeamRadius = Rationalize[3.81 1*^-6];
BeamPower = 81*^-3;
BeamAmplitude = BeamPower/(2 \[Pi] BeamRadius^2);
(* Uncomment next line to get a better plot*)
(*HoleSize = HoleSize 1*^9; BeamRadius = BeamRadius 1*^9;*)
StepSize =
  4 BeamRadius/
    100;(* Used to fit the result with a Gaussian, when \
HoleSize<<BeamRadius *)
(*2D Gaussian*)
Gaussian2D[x_, y_, Radius_: 1, Amplitude_: 1] :=
  Amplitude Exp[-1/2 ((x/Radius)^2 + (y/Radius)^2)];
(*Disk shaped hole*)
DHole[x_, y_, HoleSize_: 1] := Boole[x^2 + y^2 <= HoleSize^2];
(*Square shaped hole*)
SHole[x_, y_, HoleSize_: 1] :=
   Boole[(HoleSize >= Abs[x]) && (HoleSize >= Abs[y])];
(*Test function*)THole[x_, y_, Dummy_: 1] := DiracDelta[x, y];
Beam[x_, y_] := Gaussian2D[x, y, BeamRadius, BeamAmplitude];
Hole[x_, y_] := SHole[x, y, HoleSize];
Plot3D[Beam[x, y], {x, -4 BeamRadius,
   4 BeamRadius}, {y, -4 BeamRadius, 4 BeamRadius}, Mesh -> All,
  PlotRange -> All, ColorFunction -> "Rainbow"]
Plot3D[Hole[x, y], {x, -2 HoleSize, 2 HoleSize}, {y, -2 HoleSize,
   2 HoleSize}, Mesh -> All, PlotRange -> All,
  ColorFunction -> "Rainbow", Filling -> Axis]