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

Last change on this file since 2786 was 2786, checked in by ansari, 20 years ago

Ajout script ytrace courbe de resonance dans la base - Reza 30 Mai 2005

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