Advertisement
Wistaro

Nyquist_diag_tibasic

Nov 2nd, 2016
464
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 3.64 KB | None | 0 0
  1. ClrHome
  2. Output(1,1,"/!/ATTENTION/!/
  3. Output(3,1,"AVANT UTILISATION
  4. Output(4,1,"MERCI DE LIRE
  5. Output(5,1,"LA DOCUMENTATION
  6. Pause
  7. ClrHome
  8. {0,0}->|LNQM
  9. {0,0}->|LNQA
  10. Lbl M
  11. 1->W
  12. ClrDraw:GridOff
  13. ~20->Xmin:20->Xmax
  14. ~20->Ymin:20->Ymax
  15. Menu("NYQUIST","SAISIR FACT",S,"TRACE LIEU",TL,"RESET",R
  16. Lbl R
  17. {0}->|LNQP
  18. {0,0}->|LNQA:{0,0}->|LNQM
  19. Goto M
  20. Lbl S
  21. |LNQP(1)+1->|LNQP(1
  22. Output(2,1,"XXXXXXXXXXXXXXXXX
  23. Output(3,1,"([i])INFO([i])
  24. Output(5,1,"FACTEUR Nplotsquare
  25. Output(6,5,|LNQP(1
  26. Output(7,1,"DE VOTRE FONCTION
  27. Input "?: ",Str1
  28. Str1->Str9
  29. If inString(Str1,"e^(":Then
  30.     ClrHome:Disp "ATTENTION"
  31.     Disp "FORME EXP DETECTEE
  32.     Disp "CALCUL IMPOSSIBLE
  33.     Disp "ARG(e^(WP))=W!
  34.     Pause :Goto M
  35. End
  36. While inString(Str1,"P")
  37.     length(Str1)->L
  38.     For(theta,1,L
  39.         If sub(Str1,theta,1)="P":Then
  40.             If theta!=1:Then
  41.                 sub(Str1,1,theta-1)+"([i]W)->Str2
  42.                 Else
  43.                 "([i]W)->Str2
  44.             End
  45.            
  46.             If theta!=L:Then
  47.                 sub(Str1,theta+1,length(Str1)-theta)->Str3
  48.                 Str2+Str3->Str2
  49.             End
  50.            
  51.             Str2->Str1
  52.         End
  53.     End
  54. End
  55. ClrHome:ClrDraw:AxesOff
  56. 1*10^(~20)->W
  57. DelVar {Y1}
  58. Horizontal 15.6
  59. Line(~10,15.4,~10,~20
  60. Horizontal ~2
  61. Text(0,0,Str9
  62. Text(13,4,"MODULE
  63. Text(46,4,"PHASE
  64. Text(21,7,"(*)
  65. Text(54,7,"(+)
  66. Line(~10,7,20,7
  67. Line(~10,~11,20,~11
  68. Text(11,27,"W = 0
  69. Text(25,27,"W = INF
  70. Text(39,27,"W = 0
  71. Text(52,27,"W = INF
  72. Line(~1.21,15.6,~1.21,~20
  73.  
  74. abs(expr(Str1->D
  75. angle(expr(Str1->E
  76. D->|LNQM(1:E->|LNQA(1
  77. If D>500:Text(11,46,"INFINI"
  78. If round(D,3)=0:Text(11,46,"0"
  79. If round(D,3)!=0 and D<500:Text(11,46,D
  80.  
  81. If E>500:Text(39,46,"INFINI
  82. If round(E,3)=0:Text(39,46,"0"
  83. StorePic 1
  84.  
  85. {0,1->L1
  86. {0,E->L2
  87. LinReg(ax+b) {Y1}
  88. Equ>String({Y1},Str6
  89. sub(Str6,1,length(Str6)-3->Str6
  90. DelVar {Y1}
  91. ClrDraw:RecallPic 1
  92. If round(E,3)!=0 and E<500:Text(39,46,Str6
  93. 10^20->W
  94. If inString(Str1,"e^("):10^10->W
  95. abs(expr(Str1->F
  96. angle(expr(Str1->G
  97. F->|LNQM(2:G->|LNQA(2
  98. If F>500:Text(25,46,"INFINI
  99. If round(F,3)=0:Text(25,46,"0"
  100. If F<500 and round(F,3)!=0:Text(25,46,F
  101.  
  102. If G>500:Text(52,46,"INFINI
  103. If round(G,3)=0:Text(52,46,"0
  104. StorePic 1
  105. {0,1->L1
  106. {0,angle(expr(Str1))->L2
  107. LinReg(ax+b) {Y1}
  108. Equ>String({Y1},Str7
  109. sub(Str7,1,length(Str7)-3->Str7
  110. DelVar {Y1}
  111. ClrDraw:RecallPic 1
  112. If G<500 and round(G,3)!=0:Text(52,46,Str7
  113. Pause
  114. Goto M
  115. Lbl TL:ClrHome
  116. Output(7,1,"W=0
  117. Input "MODULE?: ",H
  118. H->|LNQM(1
  119. Output(7,1,"W=INF"
  120. Input "MODULE?: ",H
  121. H->|LNQM(2
  122. ClrHome
  123. Output(7,1,"W=0"
  124. Input "ARG?: ",H
  125. H->|LNQA(1
  126. Output(7,2,"W=INF
  127. Input "ARG?: ",H
  128. H->|LNQA(2
  129. If |LNQM(1)>20:20->|LNQM(1
  130. If |LNQM(2)>20:20->|LNQM(2
  131.  
  132. If |LNQM(1)<~20:~20->|LNQM(1
  133. If |LNQM(2)<~20:~20->|LNQM(2
  134. max(|LNQM(2),|LNQM(1)->U
  135. U->Xmax:U->Ymax
  136. ~U->Xmin:~U->Ymin
  137. AxesOn
  138.  
  139. |LNQM(1)->B
  140. 0->M:0.05->T
  141.  
  142.  
  143.  
  144. If |LNQA(1)<|LNQA(2):Then
  145.     For(A,|LNQA(1),|LNQA(2),T
  146.         M+1->M
  147.     End
  148.     For(A,|LNQA(1),|LNQA(2),T
  149.         If |LNQM(1)>|LNQM(2):B-((|LNQM(1)-|LNQM(2))/M)->B
  150.         If |LNQM(1)<|LNQM(2):B+((|LNQM(2)-|LNQM(1))/M->B
  151.         Pt-On(P>Rx(B,A),P>Ry(B,A)
  152.         Pt-On(P>Rx(B,A),~P>Ry(B,A)
  153.     End
  154. End
  155. If |LNQA(1)>|LNQA(2):Then
  156.     For(A,|LNQA(2),|LNQA(1),T
  157.         M+1->M
  158.     End
  159.    
  160.     For(A,|LNQA(2),|LNQA(1),T
  161.         If |LNQM(1)>|LNQM(2):B-((|LNQM(1)-|LNQM(2))/M)->B
  162.         If |LNQM(1)<|LNQM(2):B+((|LNQM(2)-|LNQM(1))/M)->B
  163.         Pt-On(P>Rx(B,A),P>Ry(B,A)
  164.         Pt-On(P>Rx(B,A),~P>Ry(B,A)
  165.     End
  166.    
  167. End
  168. If |LNQA(1)=|LNQA(2:Then
  169.     If |LNQM(1)<|LNQM(2):Then
  170.         For(A,|LNQM(1),|LNQM(2),T
  171.             Pt-On(P>Rx(A,|LNQA(1)),P>Ry(A,|LNQA(1))
  172.             Pt-On(P>Rx(A,|LNQA(1)),~P>Ry(A,|LNQA(1))
  173.         End
  174.     End
  175.    
  176.     If |LNQM(1)>|LNQM(2):Then
  177.         For(A,|LNQM(2),|LNQM(1),T
  178.             Pt-On(P>Rx(A,|LNQA(1)),P>Ry(A,|LNQA(1))
  179.             Pt-On(P>Rx(A,|LNQA(1)),~P>Ry(A,|LNQA(1))
  180.         End
  181.     End
  182.    
  183. End
  184. Text(0,0,"MOD: ",|LNQM(1),"---",|LNQM(2
  185. Text(7,0,"ARG: ",|LNQA(1),"---",|LNQA(2
  186. Pause
  187. Goto M
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement