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 | ################################################################
|
---|
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 |
|
---|
19 | defscript 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
|
---|
29 | endscript
|
---|
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 |
|
---|
40 | defscript 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"
|
---|
42 | endscript
|
---|
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 |
|
---|
53 | defscript plotphase
|
---|
54 | func atan2(-2*$2*x,$1*$1-x*x) $4 $5 200 "$6"
|
---|
55 | endscript
|
---|
56 | # ...........................................................
|
---|
57 |
|
---|
58 |
|
---|
59 | # Choix des parametres
|
---|
60 | om0 = 1.
|
---|
61 | lambda = 0.45
|
---|
62 | f0om = 3.
|
---|
63 | omegares $om0 $lambda $f0om "boxmarker5 $col" -1
|
---|
64 |
|
---|
65 | # Choix de la liste de couleurs et des valeurs d'amortissement
|
---|
66 | set colors ( red siennared orange yellow green blue blueviolet )
|
---|
67 | set lambdas ( 0.4 0.3 0.2 0.15 0.1 0.075 0.05 )
|
---|
68 | setaxesatt 'minorticks timesfont bolditalicfont fixedfontsize'
|
---|
69 |
|
---|
70 | # echo "DBG222 ------ "
|
---|
71 |
|
---|
72 | # On trace courbe de gain et courbe de phase l'une sur l'autre
|
---|
73 | zone 1 2
|
---|
74 | gratt = 'notitle xylimits=0.,2.2,0.25,32. '
|
---|
75 | for 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 '
|
---|
88 | end
|
---|
89 |
|
---|
90 |
|
---|
91 | gratt = 'notitle xylimits=0.,2.2,-3.2,0.2 '
|
---|
92 | for 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 '
|
---|
105 | end
|
---|
106 |
|
---|
107 | w2eps resonance.eps
|
---|