Mathematica繪制電偶極子的等位線和電場線


說明

代碼非本人編寫
思路是對(推導出的近似的)解析解直接繪圖

代碼

Clear["Global`*"]
V = q/(4 Pi*Subscript[\[Epsilon], 0])*(1/r1 - 1/r2)
cond = {r1 -> R - 1/2*Cos[\[Theta]], r2 -> R + 1/2*Cos[\[Theta]]}
V = V /. cond // Simplify
Series[V, {1, 0, 6}] // Normal
V1 = (l q Cos[\[Theta]])/(4 Pi R^2 Subscript[\[Epsilon], 0]) /. 
  q -> p/l
Solve[V1 == c, R]
Ee = Grad[-V1, {R, \[Theta], \[Omega]}, "Spherical"]
D[R[\[Theta]], \[Theta]]/R[\[Theta]] == Ee[[1]]/Ee[[2]]
DSolve[%, R[\[Theta]], \[Theta]]
(*繪制電偶極子的等位面*)
cylinderPlot3D[f_, {rMin_, rMax_}, {tMin_, tMax_}, opts___] := 
 ParametricPlot3D[{r Cos[t], r Sin[t], f[r, t]}, {r, rMin, rMax}, {t, 
   tMin, tMax}, opts]
f[r_, t_] := 1/r^2 * Cos[t];
cylinderPlot3D[f, {0.01, 3}, {0, 2 Pi}, PlotRange -> {-3, 3}, 
 PlotPoints -> 30, BoxRatios -> {1, 1, 1}]

(*繪制電偶極子的電場線*)
g1 = PolarPlot[
   Evaluate[Table[k*Sin[Pi/2 - t]^2, {k, 10, 50, 10}]], {t, 0, 2 Pi}, 
   DisplayFunction -> Identity];
g2 = PolarPlot[
   Evaluate[
    Table[Abs[Sqrt[Cos[Pi/2 - t]]]/(0.025 + k*0.01), {k, 0, 4, 
      1}]], {t, 0, 2 Pi},
   PlotStyle -> Dashing[{0.02}], DisplayFunction -> Identity];
Show[{g1, g2}, DisplayFunction -> $DisplayFunction,
 Epilog -> {PointSize[0.03], Hue[2], Point[{0, -2.5}], 
   PointSize[0.03], Hue[0.3], Point[{0, 2.5}]}
 ]

參考

《mathematica在電磁場理論中的應用》
https://mathematica.stackexchange.com/questions/19076/how-do-i-make-a-3dplot-using-cylindrical-coordinates


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM