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

  1. 1  '             INSERTION LOSSES OF COAXIAL CAVITIES
  2. 2  '
  3. 3  '   Written for the Amiga computer by Robert F. Arnesen, P.E.  3/24/86
  4. 4  '
  5. 5  '   Re-written for IBM type machines 20 February 1987.
  6. 6  '
  7. 7  '  This is a program for finding the insertion loss of a quarter wave
  8. 8  'coaxial cavity as a function of its loaded to its unloaded Q.
  9. 9  '
  10. 10  SCREEN 2: CLS
  11. 11  A = 40                              'Y axis offset
  12. 12  B = 100                             'Y axis multiplier
  13. 13  C = 2.30258                        'Ln to base 10 conversion
  14. 14  D = 171                             'X axis location
  15. 15  E = A+530                           'End of X axis
  16. 16  F = 160                             'No. of horiz. lines in graph
  17. 17  U = 2                               'No. of log cycles desired
  18. 18  '
  19. 19  FOR K=D TO 5 STEP -8
  20. 20    LINE (A,K)-(E,K)                  'Draw the 20 horizontals
  21. 21  NEXT K                              '(one for every eighth line)
  22. 22  '
  23. 23  FOR K=1 TO 10
  24. 24    GOSUB 62                          'Draw the first cycle
  25. 25  NEXT K
  26. 26  '
  27. 27  FOR K=20 TO 100 STEP 10
  28. 28    GOSUB 62                          'Draw the second cycle
  29. 29  NEXT K
  30. 30  '
  31. 31              'Print the title & designations for the graph
  32. 32  LOCATE 1,1: PRINT "dB Atten."
  33. 33  LOCATE 1,15
  34. 34  PRINT "INSERTION LOSS IN dB versus LOADED/UNLOADED Q"
  35. 35  '
  36. 36  LOCATE 22,73: PRINT "QL";           'Print X axis title
  37. 37  LINE (590,180)-(600,170)
  38. 38  LOCATE 23,76: PRINT "QU";
  39. 39  '
  40. 40  LOCATE 23,5                         'The X axis numbers
  41. 41  PRINT ".01      .02   .03    .05  .07   .1        .2    .3    .5  .7    1"
  42. 42  '
  43. 43  FOR K=0 TO 20 STEP 2
  44. 44    LOCATE (K+2),2
  45. 45    PRINT K/2;                        'The Y axis numbers
  46. 46  NEXT K
  47. 47  '
  48. 48              'Line plotting routine
  49. 49  PSET (A,12)                         'Set up line origin
  50. 50  FOR K=1 TO 10 STEP 0.2
  51. 51    GOSUB 67                          'Calculate the first segment
  52. 52  NEXT K
  53. 53  '
  54. 54  FOR K=10 TO 68
  55. 55    GOSUB 67                          'Keep going
  56. 56  NEXT K
  57. 57  '
  58. 58  LOCATE 19,1                         'Put BASIC's OK here
  59. 59  '
  60. 60  END
  61. 61  '
  62. 62  X = A+(B*C*LOG(K))/U                'The U makes it 2 cycles
  63. 63  N = INT(X/8)
  64. 64  LINE (X,D)-(X,11)                   'This draws the vertical lines
  65. 65  RETURN
  66. 66  '
  67. 67  X = A+(B*C*LOG(K))/U
  68. 68  W = 20*C*LOG(1/(1-K/100))
  69. 69  Y = 11+INT(3*W)
  70. 70  LINE -(X,Y)                         'Draw the line segment
  71. 71  RETURN
  72.