CoursElectriciteMagnetisme/Gnuplot/vector.UndipolePositifNegat...

36 lines
1.2 KiB
Gnuplot

set xrange [-5:5]
set yrange [-5:5]
set iso 31 # taille de la grille de points
#set samp 37 # nombre de points utilisés
set samples 51 # nombre de points utilisés
#set clip one
set zeroaxis
unset key
prochepos = 0.9
procheneg = 0.9
a = .0001
k = 9e9
# La charge positive
Q = 1e-6
xpos = -2
set object 1 circle front at xpos,0 size 0.5 fillcolor rgb "black" lw 1
set arrow from xpos-.1,0 to xpos+.1,0 nohead front
set arrow from xpos,-0.1 to xpos,0.1 nohead front
#set arrow from -1,-6 to -1,6 ls 4 nohead
# La charge négative
q = -1e-6
xneg = 2
set object 2 circle front at xneg,0 size 0.5 fillcolor rgb "black" lw 1
set arrow from xneg-.1,0 to xneg+.1,0 nohead front
#set arrow from xneg,-0.1 to xneg,0.1 nohead front
# Le graphe
plot '++' using (\
($1<xpos-prochepos || ($1>xpos+prochepos && $1<xneg-procheneg) || $1>xneg+procheneg) || (($2>prochepos || $2<-prochepos) &&\
($1>xpos-prochepos && $1<xpos+prochepos)) || (($2>procheneg || $2<-procheneg) &&\
($1>xneg-procheneg && $1<xneg+procheneg)) ? $1 : 1/0\
):2:\
(a*k*Q*($1-xpos)/(($1-xpos)**2+$2**2)**1.5+a*k*q*($1-xneg)/(($1-xneg)**2+$2**2)**1.5):\
(a*k*Q*$2/(($1-xpos)**2+$2**2)**1.5+a*k*q*$2/(($1-xneg)**2+$2**2)**1.5)\
w vect size .06, 15 filled
pause -1