| [2786] | 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 |  | 
|---|
|  | 14 | defscript 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 | 
|---|
|  | 24 | endscript | 
|---|
|  | 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 |  | 
|---|
|  | 35 | defscript 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" | 
|---|
|  | 37 | endscript | 
|---|
|  | 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 |  | 
|---|
|  | 48 | defscript plotphase | 
|---|
|  | 49 | func atan2(-2*$2*x,$1*$1-x*x) $4 $5 200 "$6" | 
|---|
|  | 50 | endscript | 
|---|
|  | 51 | #  ........................................................... | 
|---|
|  | 52 |  | 
|---|
|  | 53 |  | 
|---|
|  | 54 | #  Choix des parametres | 
|---|
|  | 55 | om0 = 1. | 
|---|
|  | 56 | lambda = 0.45 | 
|---|
|  | 57 | f0om = 3. | 
|---|
|  | 58 | omegares $om0 $lambda $f0om "boxmarker5 $col" -1 | 
|---|
|  | 59 |  | 
|---|
|  | 60 | #  Choix de la liste de couleurs et des valeurs d'amortissement | 
|---|
|  | 61 | set colors ( red siennared orange yellow green blue blueviolet ) | 
|---|
|  | 62 | set lambdas ( 0.4 0.3   0.2   0.15  0.1  0.075 0.05 ) | 
|---|
|  | 63 | setaxesatt 'minorticks timesfont bolditalicfont fixedfontsize' | 
|---|
|  | 64 |  | 
|---|
|  | 65 | # echo "DBG222 ------ " | 
|---|
|  | 66 |  | 
|---|
|  | 67 | #  On trace courbe de gain et courbe de phase l'une sur l'autre | 
|---|
|  | 68 | zone 1 2 | 
|---|
|  | 69 | gratt = 'notitle xylimits=0.,2.2,0.25,32. ' | 
|---|
|  | 70 | for 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 ' | 
|---|
|  | 83 | end | 
|---|
|  | 84 |  | 
|---|
|  | 85 |  | 
|---|
|  | 86 | gratt = 'notitle xylimits=0.,2.2,-3.2,0.2 ' | 
|---|
|  | 87 | for 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 ' | 
|---|
|  | 100 | end | 
|---|
|  | 101 |  | 
|---|
|  | 102 | w2eps resonance.eps | 
|---|