home *** CD-ROM | disk | FTP | other *** search
/ HAM Radio 1 / HamRadio.cdr / tech / design5 / pinsloss.bas (.txt) < prev    next >
Encoding:
GW-BASIC  |  1987-02-20  |  3.6 KB  |  83 lines

  1. 1  '        INSERTION LOSS FOR 1/4 WAVE COAXIAL CAVITIES AS A
  2. 2  '              FUNCTION OF LOADED TO UNLOADED Q
  3. 3  '
  4. 4  '    Written for the Amiga computer using a Sweet-P pen plotter.  
  5. 5  'Robert F. Arnesen P.E., 9340 E. Magdalena Drive, Tucson, Ariz. 85710.
  6. 6  '23 May 1986.  Line numbers added for other BASICs 20 February 1987.
  7. 7  '
  8. 8  '  This is a pen-plotting routine which will draw the plot in black 
  9. 9  'on a red grid, pausing to permit pen changes.
  10. 10  ' 
  11. 11  A=250                                          'X origin
  12. 12  B=A+2000                                       'Right side of graph
  13. 13  C=150                                          'Y origin
  14. 14  D=C+1600                                       'Top of graph
  15. 15  E=160                                          'Horizontal line spacing
  16. 16  F=3.6                                          'Optimum D/d ratio  
  17. 17  G=0                                            'Variable
  18. 18  H=2.30258                                     'Log to base 10 conversion
  19. 19  J=377.22                                       'Horiz. corr. factor
  20. 20  L=0                                            'Variable
  21. 21  M=0                                            'Flag
  22. 22  U=2                                            'Number of cycles
  23. 23  '
  24. 24  LPRINT "RE; RO 0;"                             'Reset the plotter
  25. 25  '
  26. 26  PRINT "INSERT RED PEN THEN ENTER 'CONT'": STOP
  27. 27  '
  28. 28  G=D                                            'Initialize the variable
  29. 29  FOR K=0 TO 10                                  'Draw the horizontals
  30. 30    LPRINT "LN"; B; ","; G; ","; A; ","; G; ";"
  31. 31    G=G-E
  32. 32  NEXT K  
  33. 33  '         
  34. 34  FOR K=1 TO 10
  35. 35    GOSUB 72                                    'Draw the verticals - 1st cycle
  36. 36  NEXT K                                         
  37. 37  '
  38. 38  FOR K=20 TO 100 STEP 10
  39. 39   GOSUB 72                                     'Draw the verticals - 2nd cycle
  40. 40  NEXT K
  41. 41  ' 
  42. 42  LPRINT "PU;"
  43. 43  '
  44. 44  PRINT "INSERT BLACK PEN THEN ENTER 'CONT'": STOP
  45. 45  '
  46. 46  LPRINT "MA 220,110; TX ;.01; MA 525,110; TX ;.02; MA 700,110; TX ;.03;"
  47. 47  LPRINT "MA 920,110; TX ;.05; MA 1065,105; TX ;.07; MA 1220,110; TX ;0.1;"
  48. 48  LPRINT "MA 1525,110; TX ;0.2; MA 1700,110; TX ;0.3; MA 1920,110; TX ;0.5;"
  49. 49  LPRINT "MA 2065,110; TX ;0.7; MA 2220,110; TX ;1.0;"
  50. 50  '
  51. 51  LPRINT "MA 930,70; TX ;RATIO OF LOADED TO UNLOADED Q;"
  52. 52  LPRINT "MA 600,10; TX ;FIGURE 3.  INSERTION LOSS OF 1/4 WAVE COAXIAL CAVITY;"
  53. 53  LPRINT "RO 90; MA 130,800; TX ;ATTENUATION IN DB; RO 0;"
  54. 54  '
  55. 55  LPRINT "MA 200,1740; TX ;0; MA 180,1580; TX ;-1; MA 180,1420; TX ;-2;"
  56. 56  LPRINT "MA 180,1260; TX ;-3; MA 180,1100; TX ;-4; MA 180,940; TX ;-5;"
  57. 57  LPRINT "MA 180,780; TX ;-6; MA 180,620; TX ;-7; MA 180,460; TX ;-8;"
  58. 58  LPRINT "MA 180,300; TX ;-9; MA 160,140; TX ;-10;"
  59. 59  '
  60. 60  M=0                                            'Set the Flag
  61. 61  FOR K=1 TO 10 STEP 0.2                          
  62. 62    GOSUB 76                                     'Draw response in 1st cycle
  63. 63  NEXT K
  64. 64  '
  65. 65  FOR K=10 TO 69                                
  66. 66    GOSUB 76                                     'Draw response in 2nd cycle
  67. 67  NEXT K  
  68. 68  '
  69. 69  LPRINT "PU;"                                   'Pen up
  70. 70  '
  71. 71  END
  72. 72  '
  73. 73    X = A+INT((J*H*LOG(K))/U)                    'Figure the interval
  74. 74    LPRINT "LN"; X; ","; C; ","; X; ","; D; ";"  'Draw the vertical
  75. 75  RETURN
  76. 76  '
  77. 77    X=A+INT((J*H*LOG(K))/U)
  78. 78   Y=D-INT(E*20*LOG(1/(1-K/100))/H) 
  79. 79    IF M=0 THEN LPRINT "MA"; X "," Y; ";": M=1: GOTO 81
  80. 80    LPRINT "DA"; G; "," L; ";"                   'Draw the segment
  81. 81    G=X: L=Y                                     'Shift the coordinates
  82. 82  RETURN                  
  83.