home *** CD-ROM | disk | FTP | other *** search
GW-BASIC | 1987-02-20 | 3.0 KB | 87 lines |
- 1 ' Q CORRECTION FACTOR FOR COAXIAL CAVITIES
- 2 '
- 3 ' Written for the Amiga computer by Robert F. Arnesen, P.E. 3/23/86
- 4 '
- 5 ' Re-written for IBM type machines 20 February 1987.
- 6 '
- 7 ' This program is for plotting the correction factor to be used in order
- 8 'to determine the unloaded Q of a coaxial cavity resonator of any ratio of
- 9 'cavity to post diameter (D/d) using the ideal ratio of 3.6 to 1 as the
- 10 'criterion.
- 11 '
- 12 SCREEN 2: CLS
- 13 A = 40 'Y axis offset
- 14 B = 100 'Y axis multiplier
- 15 C = 2.30258 'Ln to base 10 conversion
- 16 D = 171 'X axis location
- 17 E = A+530 'End of X axis
- 18 F = 160 'No. of horiz. lines in graph
- 19 G = 3.6 'Optimum cavity/post
- 20 S = 385
- 21 T = 22
- 22 U = 2 'Number of log cycles
- 23 '
- 24 FOR K=D TO 5 STEP -8
- 25 LINE (A,K)-(E,K) 'Draw the 20 horizontals
- 26 NEXT K
- 27 '
- 28 FOR K=1 TO 10
- 29 GOSUB 78 'Draw the first cycle
- 30 NEXT K
- 31 '
- 32 FOR K=20 TO 100 STEP 10
- 33 GOSUB 78 'Draw the second cycle
- 34 NEXT K
- 35 '
- 36 LOCATE 22,75: PRINT "D"; 'Print X axis title
- 37 LINE (595,181)-(614,170)
- 38 LOCATE 23,77: PRINT "d";
- 39 '
- 40 FOR K=20 TO 0 STEP -2
- 41 LOCATE(22-K),2
- 42 PRINT USING "#.#"; K/20 'Print Y axis numbers
- 43 NEXT K
- 44 '
- 45 LOCATE 1,3: PRINT "K" 'Print Y axis title
- 46 '
- 47 'Print the title & X axis numbers for the graph
- 48 LOCATE 1,10
- 49 PRINT "UNLOADED Q CORRECTION FACTOR - FROM D/d = 3.6 TO ANY RATIO"
- 50 LOCATE 23,6
- 51 PRINT "1 2 3 4 7 10 20 30 40 50 70 100";
- 52 '
- 53 'Draw the coaxial cavity
- 54 LINE (S-45,T-2)-(S+103,T+28),2,BF 'Blank the cavity area
- 55 LINE (S,T)-(S+100,T+27),1,B 'Go ahead and draw it
- 56 LINE (S+32,T+7)-(S+100,T+19),1,BF 'Draw the center post
- 57 LINE (S-20,T)-(S-10,T) 'Draw the dimensioning lines
- 58 LINE (S-20,T+27)-(S-10,T+27)
- 59 LINE (S+15,T+7)-(S+25,T+7)
- 60 LINE (S+15,T+19)-(S+25,T+19)
- 61 LOCATE 5,47: PRINT "D" 'The cavity diameter
- 62 LOCATE 5,51: PRINT "d" 'The post diameter
- 63 '
- 64 'Line plotting routine
- 65 PSET (A,D) 'Set up line origen
- 66 FOR K=1 TO 10 STEP 0.2 'Plot the first section
- 67 GOSUB 82
- 68 NEXT K
- 69 '
- 70 FOR K=10 TO 100 STEP 2 'Keep going
- 71 GOSUB 82
- 72 NEXT K
- 73 '
- 74 LOCATE 19,1 'Put BASIC's OK here
- 75 '
- 76 END
- 77 '
- 78 X = A+(B*C*LOG(K))/U 'The U makes it 2 cycles
- 79 LINE (X,D)-(X,11) 'This draws the vertical lines
- 80 RETURN
- 81 '
- 82 X = A+(B*C*LOG(K))/U 'Plot insertion loss line
- 83 W = ((1+G)/LOG(G))*(LOG(K))/(1+K)
- 84 Y = D-INT(F*W)
- 85 LINE -(X,Y) 'Draw the line segment
- 86 RETURN
-