source: Sophya/trunk/SophyaPI/DemoPIApp/resonance.pic

Last change on this file was 4073, checked in by ansari, 13 years ago

Ajout script polarplot.pic (trace en coord. polaires) et modifs cosmetiques/copyright, Reza 10/05/2012

File size: 3.5 KB
RevLine 
[4073]1################################################################
2### SOPHYA class library - piapp interactive analysis tool
3### (C) LAL / Univ. Paris Sud, CNRS/IN2P3 1998-2012
4### (C) IRFU-SPP / CEA 1998-2012
5################################################################
[2786]6# Cours S1SM - Oscillateur harmonique - Courbe de resonance
7# Variation en fonction de la courbe d'amortissement
8# Reza Ansari - Janvier 2003
9
10# ...........................................................
11# Script Calcul/trace frequence / gain de resonance
12# Frequence OH non amorti $1 : Omega0
13# Amortissement $2 : Lambda
14# Force exterieur $3 : F0/m
15# $4 : graphic_att
16# $5 : if $5 < 0 --> Pas de trace, calcul omrlast et gainreslast uniquement
17#
18
19defscript omegares ' Calcul frequence / gain de resonance '
20 rpneval omres $1 sq 2 $2 sq * - sqrt
21 rpneval gainres 2. $2 * $1 sq $2 sq - sqrt * $3 x<>y /
22 echo "OmegaRes= $omres GainRes= $gainres"
23 if ( $5 > -1 ) then
24 addmarker $omres $gainres "$4"
25 addline $omrlast $gainreslast $omres $gainres 'black dottedline'
26 endif
27 set omrlast $omres
28 set gainreslast $gainres
29endscript
30# ...........................................................
31
32# ...........................................................
33# Script trace de courbe de Gain = f (omega)
34# Frequence OH non amorti $1 : Omega0
35# Amortissement $2 : Lambda
36# Force exterieur $3 : F0/m
37# $4 $5: Limite Min,Max en Omega
38# $6: graphic_att
39
40defscript plotgain ' Trace de courbe de resonance - Gain '
41 func $3/sqrt(($1*$1-x*x)*($1*$1-x*x)+4*$2*$2*x*x) $4 $5 200 "$6"
42endscript
43# ...........................................................
44
45# ...........................................................
46# Script trace de courbe de Phase = f (omega)
47# Frequence OH non amorti $1 : Omega0
48# Amortissement $2 : Lambda
49# Force exterieur $3 : F0/m
50# $4 $5: Limite Min,Max en Omega
51# $6: graphic_att
52
53defscript plotphase
54 func atan2(-2*$2*x,$1*$1-x*x) $4 $5 200 "$6"
55endscript
56# ...........................................................
57
58
59# Choix des parametres
60om0 = 1.
61lambda = 0.45
62f0om = 3.
63omegares $om0 $lambda $f0om "boxmarker5 $col" -1
64
65# Choix de la liste de couleurs et des valeurs d'amortissement
66set colors ( red siennared orange yellow green blue blueviolet )
67set lambdas ( 0.4 0.3 0.2 0.15 0.1 0.075 0.05 )
68setaxesatt 'minorticks timesfont bolditalicfont fixedfontsize'
69
70# echo "DBG222 ------ "
71
72# On trace courbe de gain et courbe de phase l'une sur l'autre
73zone 1 2
74gratt = 'notitle xylimits=0.,2.2,0.25,32. '
75for i 0:7
76 set col $colors[i]
77 set gratt "$gratt $col"
78 set lambda $lambdas[i]
79 plotgain $om0 $lambda $f0om 0. 3. "$gratt"
80 omegares $om0 $lambda $f0om "boxmarker5 $col" $i
81 if ( $i < 1 ) then
82 setaxelabels 'Frequence' 'Gain' 'timesfont bigbolditalicfont'
83 endif
84 addctext 1.6 $gainres 'l/w' '' '0' "symbolfont bigfont horizright vertcenter $col"
85 rap = $lambda/$om0
86 addtext 1.65 $gainres "= $rap" "timesfont bigboldfont horizleft vertcenter $col"
87 gratt = 'same '
88end
89
90
91gratt = 'notitle xylimits=0.,2.2,-3.2,0.2 '
92for i 0:7
93 set col $colors[i]
94 set gratt "$gratt $col"
95 set lambda $lambdas[i]
96 plotphase $om0 $lambda $f0om 0. 3. "$gratt"
97 if ( $i < 1 ) then
98 setaxelabels 'Frequence' 'Phase' 'timesfont bigbolditalicfont'
99 endif
100 yt = -0.2-0.3*$i
101 addctext 1.5 $yt 'l/w' '' '0' "symbolfont bigfont horizright vertcenter $col"
102 rap = $lambda/$om0
103 addtext 1.55 $yt "= $rap" "timesfont bigboldfont horizleft vertcenter $col"
104 gratt = 'same '
105end
106
107w2eps resonance.eps
Note: See TracBrowser for help on using the repository browser.