# Illustration de cours S1SM - Oscillateur harmonique # Reza Ansari - Decembre 2003 # Script de trace de ressort vertical defscript spring 'trace de ressort ' # $1 : Nombre de zigzag # $2 : Position de ressort en X # $3,$4 : Position YMin,YMax du ressort set ns $1 rpneval x1 $2 0.2 - rpneval x2 $2 0.2 + set ymin $3 set ymax $4 rpneval dy $ymax $ymin - $ns 2 * .5 + / set yc $ymin for i 0:$ns set y1 $yc rpneval y2 $y1 $dy + addline $x1 $y1 $x2 $y2 rpneval y1 $y1 $dy + rpneval y2 $y2 $dy + addline $x2 $y1 $x1 $y2 rpneval yc $yc $dy 2 * + end rpneval x2 $x2 0.2 - set y1 $yc rpneval y2 $yc $dy 0.5 * + addline $x1 $y1 $x2 $y2 endscript # Illustration cours Mouvement oscillateur harmonique # Trace position,vitesse,acceleration x(t), v(t), a(t) zone 1 func sin(x) -0.5 10. 100 'axesnone xylimits=-1,10.5,-7,1.5 normalline blue' func cos(x) -0.5 10. 100 'same xylimits=-1,10.,-7,1.5 normalline magenta' func -sin(x) -0.5 10. 100 'same xylimits=-1,10.5,-7,1.5 normalline red' addtext 2 1.2 'Position' 'blue bigboldfont helveticafont horizcenter' addtext 6.5 1.2 'Vitesse' 'magenta bigboldfont helveticafont horizcenter' addtext 3.7 0.5 'Acc/Force' 'red bigboldfont helveticafont horizcenter vertcenter' # Trace d'axes addarrow -1 0 10 0 'ftrianglearrow7' addtext 7 -0.5 'Temps' 'bigboldfont helveticafont horizcenter' addfrect -1 -6.5 10 -6. 'grey normalline' addline -1 -6.5 10 -6.5 'normalline' addline -1 -6. 10 -6. 'normalline' # Trace vecteur vitesse, acceleration pour t=2pi/kk for kk 0:7 rpneval x pi 2 / $kk * rpneval ym $x sin 3 - addmarker $x $ym 'blue marker=fbox,11' spring 8 $x -6 $ym rpneval vv $x cos 1 * rpneval avv $vv fabs set yv0 $ym rpneval yv1 $yv0 $vv + rpneval xv $x 0.3 - if ( $avv > 0.5 ) then addarrow $xv $yv0 $xv $yv1 'magenta ftrianglemarker9 normalline' rpneval xv $xv 0.05 - rpneval yv0 $yv0 $yv1 + 0.5 * addtext $xv $yv0 'V' 'magenta bigboldfont helveticafont horizright vertcenter' else rpneval yv0 $yv0 $yv1 + 0.5 * addtext $xv $yv0 'V=0' 'magenta bigboldfont helveticafont horizright vertcenter' endif rpneval aa $x sin -1 * rpneval aaa $aa fabs set ya0 $ym rpneval ya1 $ya0 $aa + rpneval xa $x 0.3 + if ( $aaa > 0.5 ) then addarrow $xa $ya0 $xa $ya1 'red ftrianglemarker9 normalline' rpneval xa $xa 0.05 + rpneval ya0 $ya0 $ya1 + 0.5 * addtext $xa $ya0 'F' 'red bigboldfont helveticafont horizleft vertcenter' else rpneval ya0 $ya0 $ya1 + 0.5 * addtext $xa $ya0 'F=0' 'red bigboldfont helveticafont horizleft vertcenter' endif end # On en fait un fichier postscript w2eps oh_xva_spring.eps