0
$\begingroup$

I'd appreciate it if someone could help converting my code so that the graph shows value in Decibel, which normally can be easily done using the formula below.

enter image description here

enter image description here

I managed to draw the graph in Amplitude, as shown on the figure above, but when I try to change it into decibel by multiplying it with 10 Log[], the graph shows peaks of infinite decibel values, and became like this: enter image description here

Here is my code, I really hope I can get some help figuring this out.

Clear["Global`*"]
a = 3 λ; b = 2 λ;
β = (2 π)/λ; E0 = 1; r = λ/4;
X = (β a)/2 Sin[θ] Cos [ϕ];
Y = (β b)/2 Sin[θ] Sin[ϕ];
Z = I (a b β E0 Exp[-I β r])/(2 π r);
Et[θ_, ϕ_] := √((Z/
       2 Sin[ϕ] (1 + Cos[θ]) Sinc[X] Sinc[Y])^2 + (Z/
       2 Cos[ϕ] (1 + Cos[θ]) Sinc[X] Sinc[Y])^2);
SphericalPlot3D[
 Et[θ, ϕ], {θ, 0, 2  Pi}, {ϕ, 0, 2  Pi}, 
 Mesh -> None, PlotPoints -> 30, PlotRange -> All, Axes -> True, 
 AxesOrigin -> {0, 0, 0}, PlotStyle -> Directive, Boxed -> False]

Thanks in advance!

$\endgroup$
1
  • 1
    $\begingroup$ The Log of zero is minus infinity. Therefore, you will not be able to draw directions where Et is small. You could e.g. only draw if Et is bigger than some threshold. $\endgroup$ – Daniel Huber Apr 27 at 16:17

Your Answer

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

Browse other questions tagged or ask your own question.