1 \documentclass{article
}
2 \usepackage[a4paper,margin=
2cm
]{geometry
}
3 \usepackage[latin1]{inputenc}
4 \usepackage{pstricks,pst-eqdf
}
6 \newpsstyle{vecteurA
}{arrowinset=
0.05,arrowsize=
0.125,linecolor=
{[rgb
]{1 0.5 0}}}
7 \newpsstyle{vecteurB
}{arrowinset=
0.05,arrowsize=
0.1,linecolor=
{[rgb
]{0 0.7 1}}}
8 \newpsstyle{vecteurC
}{arrowinset=
0.1,arrowsize=
0.2,linecolor=
{[rgb
]{1 0.5 0}}}
10 \title{Animation du mouvement d'un satellite
}
13 \begin{filecontents
}{satellite.dat
}
68 \newcommand{\Jupiter}{%
69 \psclip{\pscircle[fillstyle=solid,fillcolor=yellow
]{1.5}}
70 \psset{fillstyle=solid,fillcolor=
{[cmyk
]{0 0.2 0.4 0}},linestyle=none
}
72 \psframe(-
2,
0.45)(
2,
0.52)
73 \psframe(-
2,
.05)(
2,
.3)
74 \psframe(-
2,-
0.35)(
2,-
0.2)
75 \psframe(-
2,-
0.9)(
2,-
.5)
77 \psellipse[fillstyle=solid,fillcolor=
{[cmyk
]{0 0.4 0.6 0}},linestyle=none
](-
0.3,-
0.6)(
0.35,
0.2)
81 y
[2]|y
[3]|-GM*y
[0]/((sqrt(y
[0]^
2+y
[1]^
2))^
3)|-GM*y
[1]/((sqrt(y
[0]^
2+y
[1]^
2))^
3)
}%
83 %\begin{pspicture}(-10,-10)(6,6)
84 \def\nFrames{50}% 50 images
85 \begin{animateinline
}[controls,loop,timeline=satellite.dat,
%
86 begin=
{\begin{pspicture
}(-
10,-
10)(
6,
6)
},
87 end=
{\end{pspicture
}}]{5}% 5 images/s
88 %\uput[r](0,3){$y$}\uput[u](3,0){$x$}
90 \psframe*
[linecolor=
{[rgb
]{0 0 0.5}}](-
10,-
10)(
6,
6)
91 \pstVerb{/tabXiYi
[(XiYi.dat) run
] def
}%
95 /x0 r0 theta0 cos mul def
96 /y0 r0 theta0 sin mul def
98 /v0x v0 theta0 sin mul neg def
99 /v0y v0 theta0 cos mul def
100 /Lc r0 v0 mul def
% moment cinetique
101 /par Lc dup mul GM div def
% paramètre de l'ellipse
103 /exc
1 0.5 v0
4 exp mul r0 dup mul mul GM r0 mul v0 dup mul mul sub GM dup mul div
2 mul add sqrt def
105 /a_2 par
1 exc dup mul sub div def
% demi-grand axe
106 /b_2 par
1 exc dup mul sub sqrt div def
% demi-petit axe
107 /periode
2 3.1416 dup mul a_2
3 exp mul GM div sqrt mul def
}%
108 \psequadiff[method=rk4,
114 % saveData,filename=XiYi.dat
115 ]{0}{43}{x0 y0 v0x v0y
}{\eqsatellite}%
116 \listplot[linecolor=gray,unit=
2]{XiYi aload pop
}
117 \psequadiff[method=rk4,
123 % saveData,filename=vxvy.dat
124 ]{0}{43}{x0 y0 v0x v0y
}{\eqsatellite}%
125 %\listplot[unit=2,linecolor=red]{vxvy aload pop}
126 % on dessine la vitesse un point sur 50
127 %\pscircle[fillcolor=gray!70,fillstyle=solid,unit=2](0,0){0.4}
129 %\psgrid[subgriddiv=2,gridcolor=lightgray,gridlabels=8pt,unit=2](-5,-5)(3,3)
130 %\psline[arrowinset=0.05,arrowsize=0.1,unit=2]{<->}(3,0)(0,0)(0,3)
132 \multiframe{\nFrames}{i=
0+
40}{
134 \pstVerb{/tabXYpartiel
{
135 2 2 \i\space {/I exch def
140 /vX vxvy
\i\space get def
141 /vY vxvy
\i\space 1 add get def
142 /xi tabXiYi
\i\space get def
143 /yi tabXiYi
\i\space 1 add get def
144 /ri3 xi dup mul yi dup mul add sqrt
3 exp def
145 /Fx xi ri3 div neg def
146 /Fy yi ri3 div neg def
}%
147 \listplot[linecolor=red,linewidth=
0.05]{tabXYpartiel
}
148 \rput(!xi yi)
{\pscircle[fillstyle=solid,fillcolor=gray!
50]{0.075}\psline[style=vecteurA
]{->
}(! vX
2 mul vY
2 mul)
\psline[style=vecteurB
]{->
}(! Fx
5 mul Fy
5 mul)
}}
150 \listplot[linecolor=gray,unit=
2]{XiYi aload pop
}
151 \listplot[linecolor=red,unit=
2,linewidth=
0.05]{XiYi aload pop
}
153 \rput(!x0 y0)
{\pscircle[fillstyle=solid,fillcolor=gray!
50]{0.075}\psline[style=vecteurA
]{->
}(! v0x
2 mul v0y
2 mul)
\psline[style=vecteurB
]{->
}(! x0 r0
3 exp div
5 mul neg y0 r0
3 exp div
5 mul neg)
}