[pstricks] Re : Elektrostatic Field and equipotentiallines

Herbert Voss Herbert.Voss at FU-Berlin.DE
Tue Jan 19 20:06:48 CET 2010


Am 18.01.2010 21:32, schrieb Thomas Söll:

> ist possible to draw an equipotentialline in your solution of the
> fildlines through an given point?

also with Manuels solution. But I do not understand
why the V lines are far away from the charges?

Herbert

\documentclass{article}
\usepackage{pstricks-add}
\makeatletter
\let\ScreenCoor\tx at ScreenCoor
\makeatother
\def\FieldLines{
  0 1 NoQ { /i ED xP i getX sub yP i getY sub Pyth } for
  NoQ 1 add array astore /Radius ED
  0 0
  0 1 NoQ { /i ED
    i getQ xP i getX sub mul i getR 3 exp Div add exch
    i getQ yP i getY sub mul i getR 3 exp Div add exch
  } for
  /Ex ED  /Ey ED
  /NormeE Ex Ey Pyth def
  /dX Ex NormeE div pasX mul def
  /dY Ey NormeE div pasX mul def
}

\begin{document}

\def\NoQ{4}
\def\dAngle{18}
\def\Qcharge{ 1 1 1 1}
\def\Xcoor{ -2.5  2.5 2.5 -2.5}
\def\Ycoor{ -2.5 -2.5 2.5  2.5}

\pstVerb{
      /xmin -5 def /xmax 5 def /ymin -5 def /ymax 5 def
      /pasX xmax xmin sub 200 div def % 0.05
      /NoQ \NoQ\space 1 sub def
      /Qcharge [\Qcharge] def
      /Xcoor [\Xcoor] def
      /Ycoor [\Ycoor] def
      /getX { Xcoor exch get } def
      /getY { Ycoor exch get } def
      /getQ { Qcharge exch get } def
      /getR { Radius exch get } def
}
\begin{center}
\begin{pspicture*}(-5,-5)(5,5)
\multido{\iB=0+1}{\NoQ}{%
  \psforeach{\iA}{0,10,..,360}{%
    \psparametricplot[plotpoints=2000]{xmin}{xmax}[{
      /xStart \iB\space getX  def
      /yStart \iB\space getY def
      /pasX  \iB\space getQ dup abs Div 0.05 mul def
      /xP xStart pasX \iA\space cos mul add def
      /yP yStart pasX \iA\space sin mul add def
 }]{\FieldLines
   /xP xP dX add def /yP yP dY add def xP yP }%
  }
  \pscustom{
  \code{
    0 1 NoQ { /i exch def
      i getX i getY \ScreenCoor\space 10 i getQ abs mul 0 360 arc
        gsave i getQ 0 gt {1 0 0}{0 0 1}ifelse setrgbcolor fill grestore
stroke
    } for
  }}
}
%
\multido{\rX=-8.1+0.5}{32}{%
  \psparametricplot[plotpoints=1000,linecolor=blue]{0}{1}[{
      /xStart 0 getX  def
      /yStart 0 getY def
      /pasX 0.017 def
      /xP \rX\space def
      /yP 0 def
 }]{\FieldLines
      /dY Ex NormeE div pasX mul neg def
      /dX Ey NormeE div pasX mul def
      /xP xP dX add def
      /yP yP dY add def
      xP yP }
}
\end{pspicture*}
\end{center}
\end{document}


More information about the PSTricks mailing list