[pstricks] Re : Re : Elektrostatic Field and equipotentiallines
mluque5130 at aol.com
mluque5130 at aol.com
Tue Jan 19 06:53:14 CET 2010
Thomas Söll <Thomas.Soell at lehrer.uka.de> a écrit :
> Hallo Herbert
>ist possible to draw an equipotentialline in your solution of the fildlines through an given point?
It is not Herbert, but here is a suggestion: you calculate the potential at one point and you draw the line perpendicular to field lines (-dY, dX).
An example to improve.
Best regards,
\documentclass{article}
\usepackage{pstricks,pst-plot}
\SpecialCoor
\def\FieldLines{%
/r1 xP xA sub dup mul yP dup mul add sqrt def
/r2 xP xA add dup mul yP dup mul add sqrt def
/V q1 r1 div
q2 r2 div
add def
% Ex=-dV/dx
/Ex q1 xP xA sub mul r1 3 exp div
q2 xP xA add mul r2 3 exp div
add def
% Ey=-dV/dy
/Ey yP
q1 r1 3 exp div
q2 r2 3 exp div
add mul def
/NormeE Ex dup mul Ey dup mul add sqrt def
/dX Ex NormeE div pasX mul def
/dY Ey NormeE div pasX mul def
}
\begin{document}
\begin{center}
\begin{pspicture*}(-6,-8)(10,8)
% les limites
\pstVerb{/xmin -5 def /xmax 5 def /ymin -5 def /ymax 5 def}%
% le pas d'itération
\pstVerb{/pasX 0.025 def}%
\pstVerb{/q1 1 def % les charges
/q2 -0.5 q1 mul def
/xA -2.5 def}%
% 15 degrés entre chaque ligne (24*15=360)
\multido{\iA=0+24}{15}{% 15 lignes de champ
\pstVerb{/xStart xA def
/pasX q1 q1 abs div 0.05 mul def
/xP xStart pasX \iA\space cos mul add def
/yP 0 pasX \iA\space sin mul add def}%
\parametricplot[plotpoints=2000,linecolor=blue]{xmin}{xmax}{%
\FieldLines
/xP xP dX add def
/yP yP dY add def
xP yP
}
\pstVerb{/xStart xA neg def
/pasX q2 q2 abs div 0.05 mul def
/xP xStart pasX \iA\space cos mul add def
/yP 0 pasX \iA\space sin mul add def}%
\parametricplot[plotpoints=2000,linecolor=blue]{xmin}{xmax}{%
\FieldLines
/xP xP dX add def
/yP yP dY add def
xP yP
}}
\pstVerb{/pasX 0.01 def}%
\multido{\rX=-2+0.5}{9}{%
\pstVerb{/xP \rX\space def}%
\parametricplot[plotpoints=1000,linecolor=red]{0}{1}{%
\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
}
\parametricplot[plotpoints=1000,linecolor=red]{0}{1}{%
\FieldLines
% on part perpendiculairement aux lignes de champ
/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 neg
}}
\pscircle[fillstyle=solid](!xA 0){0.2}\pscircle[fillstyle=solid](!xA neg 0){0.2}
\end{pspicture*}
\end{center}
\end{document}
=
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://tug.org/pipermail/pstricks/attachments/20100119/1effea2b/attachment.html>
More information about the PSTricks
mailing list