1
$\begingroup$

I would like to get a DensityPlot of a "Donut" with a Gaussian radial cross-section.

Here the cross-section function:

Plot[Amplitude Exp[-(x - Position)^2/(2 Width^2)], {x, 0, 20}]

How can I plot this and ensure the scale is linear grayscale?

I am a newbie with Mathematica 10, any help is greatly appreciated.

Best regards Mat

$\endgroup$
  • $\begingroup$ Welcome to Mathematica.SE! I suggest the following: 1) As you receive help, try to give it too, by answering questions in your area of expertise. 2) Take the tour! 3) When you see good questions and answers, vote them up by clicking the gray triangles, because the credibility of the system is based on the reputation gained by users sharing their knowledge. Also, please remember to accept the answer, if any, that solves your problem, by clicking the checkmark sign! $\endgroup$ – Michael E2 Aug 2 '16 at 19:15
  • 4
    $\begingroup$ With[{amp = 1, r0 = 3, width = 1}, DensityPlot[ amp Exp[-(Sqrt[x^2 + y^2] - r0)^2 / (2 width^2)], {x, -10, 10}, {y, -10, 10}, ColorFunction -> GrayLevel, PlotPoints -> 50, PlotRange -> All, PlotLegends -> Automatic] ] $\endgroup$ – Jason B. Aug 2 '16 at 19:18
  • $\begingroup$ @JasonB, go ahead ... please $\endgroup$ – user9660 Aug 2 '16 at 19:32
  • $\begingroup$ Thank you JasonB! That was actually obvious, I was so into the documentation I forgot to switch one my brain! $\endgroup$ – O_o Aug 2 '16 at 19:42
3
$\begingroup$
Manipulate[
 DensityPlot[ 
  Exp[-(Sqrt[x^2 + y^2] - r0)^2/(2 width^2)], {x, -10, 10}, {y, -10, 
   10},
  ColorFunction -> GrayLevel,
  PlotPoints -> 50,
  PlotRange -> All,
  PlotLegends -> Automatic],
 {{r0, 1}, 0.1, 8},
 {{width, 1/2}, .1, 4}]

Mathematica graphics

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.