CoursElectriciteMagnetisme/Gnuplot/vector.UndipoleAddPlusPlus.gnu

32 lines
1.2 KiB
Gnuplot

set xrange [-5:5]
set yrange [-5:5]
set iso 30 # taille de la grille de points
#set samp 37 # nombre de points utilisés
set samples 48 # nombre de points utilisés
#set clip one
set zeroaxis
unset key
prochepos = 0.5
procheneg = 0.8
a = .0001
k = 9e9
# La charge positive
Q = 1e-6
xpos = -2
set object 1 circle front at xpos,0 size 0.1 fillcolor rgb "black" lw 1
set arrow from xpos-.06,0 to xpos+.06,0 nohead front
set arrow from xpos,-0.07 to xpos,0.07 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.1 fillcolor rgb "black" lw 1
set arrow from xneg-.06,0 to xneg+.06,0 nohead front
#set arrow from 1,-6 to 1,6 nohead
# 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