CoursElectriciteMagnetisme/Gnuplot/vector.UndipolePositif.gnu

36 lines
1.2 KiB
Plaintext
Raw Permalink Normal View History

2024-02-03 20:45:14 +01:00
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.6
procheneg = 0.6
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 xneg,-0.07 to xneg,0.07 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