CoursElectriciteMagnetisme/Gnuplot/vector.PositifNegatif.gnu

41 lines
1.4 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 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
set key on inside height 1
prochepos = 0.5
procheneg = 0.9
a = .0001
k = 9e9
# La charge positive
Q = 0.5e-6
xpos = -2
rayonpos = 0.4
signepos = 0.1
set object 1 circle front at xpos,0 size rayonpos fillcolor rgb "black" lw 1
set arrow from xpos-signepos,0 to xpos+signepos,0 nohead front
set arrow from xpos,-signepos to xpos,signepos nohead front
#set arrow from -1,-6 to -1,6 ls 4 nohead
# La charge négative
q = -1e-6
xneg = 2
rayonneg = 0.4
signeneg = 0.1
set object 2 circle front at xneg,0 size rayonneg fillcolor rgb "black" lw 1
set arrow from xneg-signeneg,0 to xneg+signeneg,0 nohead front
#set arrow from xneg,-signeneg to xneg,signeneg 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 title "Charges : 0.5e-6 C ; 1e-6 C"
pause -1