Image plane of a flat-top beam under the effect of the first 21 Zernike polynomials. The beam starts in the so-called Fourier plane, which is imaged onto the image plane by an ideal lens.
A lens of focal length f is a Fourier-transform device between the place at distance f before it and the plane at distance f after it. These planes are called "Fourier" and "Image" plane respectively.
(*https://mathematica.stackexchange.com/questions/33574/whats-the-\ correct-way-to-shift-zero-frequency-to-the-center-of-a-fourier-transf*) fftshift[dat_?ArrayQ, k : (_Integer?Positive | All) : All] := Module[{dims = Dimensions[dat]}, RotateRight[dat, If[k === All, Quotient[dims, 2], Quotient[dims[[:w:k]], 2] UnitVector[Length[dims], k]]]] ZernikePoly = Table[Table[ If[m < 0, Sqrt[(2 (n + 1))/(\[Pi] (1 + KroneckerDelta[0, m]))] ZernikeR[n, -m, \[Rho]] Sin[m \[Theta]], Sqrt[(2 (n + 1))/(\[Pi] (1 + KroneckerDelta[0, m]))] ZernikeR[n, m, \[Rho]] Cos[m \[Theta]]], {m, -n, n, 2}], {n, 0, 5}] /. {\[Rho] -> Sqrt[x^2 + y^2], \[Theta] -> ArcTan[x, y]} // FullSimplify (*The flat-top beam size (HeavisideTheta) has radius 1*) (*The Fourier plane is taken to be much larger than the aperture size*) (*The Fourier transform is the result of the imaging setup*) (*Each Zernike polynomial is simulated with a coefficient of 2*) Column[Map[ ArrayPlot[ Abs[fftshift[ Fourier[Table[ HeavisideTheta[1 - Sqrt[x^2 + y^2]]/Sqrt[\[Pi]] E^(-I 2 #), {y, -20, 20, 0.051}, {x, -20, 20, 0.051}]]]]^2, PlotRange -> {{393 - 60, 393 + 60}, {393 - 60, 393 + 60}}, PlotTheme -> "Scientific"] & , ZernikePoly, {2}], Center] Export["ZernikeAiryImage.jpg", %]
Licensing
I, the copyright holder of this work, hereby publish it under the following license:
to share – to copy, distribute and transmit the work
to remix – to adapt the work
Under the following conditions:
attribution – You must give appropriate credit, provide a link to the license, and indicate if changes were made. You may do so in any reasonable manner, but not in any way that suggests the licensor endorses you or your use.
share alike – If you remix, transform, or build upon the material, you must distribute your contributions under the same or compatible license as the original.
Image plane of a flat-top beam under the effect of the first 21 Zernike polynomials (as above). The beam goes through an aperture of the same size, which is imaged onto this plane by an ideal lens.