2
$\begingroup$

I'm trying to replicate the figure below. Now a nice first approach to do this is by using Mathematica, by making some kind of contourplot with circles and just add a gradient to the contourstyle. Now however I'm not sure how to add a gradient to my lines, is this possible or not ? Any help would be greatly appreciated!

Fresnel zone

$\endgroup$

2 Answers 2

8
$\begingroup$

I presume you're plotting a Fresnel zone plate.

DensityPlot[Sin[50 Sqrt[1 + x^2 + y^2]]^2, 
 {x, -1, 1}, {y, -1, 1},
 PlotPoints -> 100, 
 ColorFunction -> GrayLevel,
 Frame -> None]

enter image description here

And if you'd like to overlap two Fresnel plates, just use Manipulate:

Manipulate[
 DensityPlot[
  Sin[50 Sqrt[1 + x^2 + y^2]]^2 + Sin[50 Sqrt[1 + (x + dx)^2 + y^2]]^2,
  {x, -1, 1}, {y, -1, 1},
  PlotPoints -> 40,
  ColorFunction -> GrayLevel,
  Frame -> None],
 {dx, 0, .5, .01}]
$\endgroup$
8
  • $\begingroup$ That's very correct ! :) I'm trying to make two of these images whith the necessary transparency so that I can slide them on top of eachother in order to explain interference. I should have tought indeed at the grayscale colorfunction :). Do you know if there is a way to add extra transparency for the more white parts ? $\endgroup$
    – Nick
    May 23, 2015 at 20:44
  • $\begingroup$ That's nice! I had not recognized the pattern that the OP desired. The Manipulate trick is nice as well. (+1) $\endgroup$
    – MarcoB
    May 23, 2015 at 21:10
  • $\begingroup$ "extra transparency for the more white parts" - I'm guessing you can use here the two-argument form of GrayLevel[] to have the alpha channel vary along with the gray. $\endgroup$ May 24, 2015 at 3:28
  • $\begingroup$ @DavidG.Stork It's to use in a general presentation about light and it's wavecharacter. I'm probably going to make a presentation in powerpoint, hence the question of the transperancy. For example the figure that I gave above is a .png file with all of the white transparent. If you slide two of them over eachother you clearly see the interference pattern emerging. I try to do the presentation without mathematics because it's a presentation for high schoolers who still think math is somekind of magic ;). But indeed somekind of cutoff might work! $\endgroup$
    – Nick
    May 24, 2015 at 10:31
  • $\begingroup$ @Nick As a member of OSA since 1980, co-author of Seeing the light and research scientist in computational optics, I know well Fresnel zone plates. I recommend, though, that you make a Mathematica Slide Show with the manipulate for your students. I try to do as many of my interactive demonstrations in Mathematica as possible. Look at the Wolfram Demonstrations site and search "optics" for numerous great demos you can show your students. $\endgroup$ May 25, 2015 at 17:42
3
$\begingroup$

I think a ContourPlot will do nicely here, as you suggested. The coloring can be obtained with the built-in GrayLevel color function.

You can choose how dense the contour lines are by either plotting over a larger domain than the unit square, or by changing the coefficients to $x^2$ and $y^2$ within the $\cos$ function. The negative sign is there to reproduce the black color of the contour at $(0,0)$.

It takes quite a few points to get a good contour; plotting took ca. 10s on my machine. You may get faster evaluation by tinkering with a combination of PlotPoints and MaxRecursion instead.

ContourPlot[
 -Cos[75 x^2 + 75 y^2], {x, y} \[Element] Rectangle[{-1, -1}, {1, 1}],
 ColorFunction -> GrayLevel,
 PlotPoints -> 300, MaxRecursion -> 0,
 Frame -> None
]

hypnotizing contour plot

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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