0
$\begingroup$

I'm attempting to make a graph of the equipotential curves of two point charges while showing the electric field lines. I can do the electric field lines but the equipotentials are giving me trouble.

My sample for one point charge was:

equipots1 = ContourPlot[
              V1plot, {x, xmin, xmax}, {y, ymin, ymax}, 
              ContourShading -> None, Contours -> 10, AspectRatio -> ar,
              ImageSize -> Small, ContourStyle -> {{Purple, Opacity[0.6]}}
            ]
$\endgroup$
1
  • 1
    $\begingroup$ What's the formula for the potential for one point source? Two? (Remember about superposition.) Once you have that, with an appropriate substitution for $r$, you can just plug it into ContourPlot. $\endgroup$
    – rcollyer
    Feb 6, 2017 at 3:49

1 Answer 1

3
$\begingroup$

Consider two charges, Q1 and Q2, centered at positions, pos1 and pos2, respectively.

k = 9*10^9;

Then, you can write a function which takes Q1, Q2, pos1, pos2, and an equivalent r as arguments.

plotEquipotential[Q1_, Q2_, pos1_, pos2_, r_] := 
 ContourPlot[
  k Q1/Norm[{x, y} - pos1] + k Q2/Norm[{x, y} - pos2] == k/r, 
  {x, -10, 10}, {y, -10, 10}
 ]

Example plot:

plotEquipotential[1, 2, {0,0}, {0,3}, 1]

enter image description here

To create a gif:

Export["equipotentialPlot.gif", 
 plotEquipotential[1, 2, {0, 0}, {0, 3}, #] & /@ Range[0.1, 2, 0.1], 
 "DisplayDurations" -> 0.2]

enter image description here

$\endgroup$
2
  • $\begingroup$ Instead of crafting your own norm function, Norm does it all for you. $\endgroup$
    – rcollyer
    Feb 6, 2017 at 4:59
  • $\begingroup$ Didn't know that. Thank you. $\endgroup$ Feb 6, 2017 at 5:04

Your Answer

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

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