home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
HAM Radio 1
/
HamRadio.cdr
/
ant
/
antenna
/
taylor.bas
< prev
next >
Wrap
BASIC Source File
|
1979-12-31
|
5KB
|
186 lines
10 REM TAYLOR ARRAY SYNTHESIS
20 REM "ANTENNA DESIGN USING PERSONAL COMPUTERS"
30 DIM IA(50),INR(50),INI(50),WR(50),WI(50)
40 PI=3.141593
50 DEF FNLOG10(X)=.4343*LOG(X)
60 KEY OFF
70 CLS
80 SCREEN 0,1
90 COLOR 1,0
100 PRINT "THIS PROGRAM COMPUTES THE TAYLOR COEFFICIENTS FOR AN"
110 PRINT "M-ELEMENT ARRAY, WITH A SPECIFIED SIDELOBE LEVEL"
120 COLOR 4,0
130 PRINT
140 INPUT "HOW MANY ELEMENTS IN THE ARRAY";M
150 INPUT "WHAT IS THE SPACING BETWEEN ELEMENTS(WAVELENGTHS)";D
160 INPUT "WHAT IS THE DESIRED SIDELOBE LEVEL(+dB)";RDB
170 INPUT "WHAT IS THE DESIRED VALUE OF N-BAR(INTEGER FROM 2 TO 6)";NBAR
180 NBAR=INT(NBAR)
190 IF NBAR<2 OR NBAR>6 THEN GOTO 170
200 COLOR 14,0
210 N=M-1
220 L=M*D
230 R=10^(RDB/20)
240 A=LOG(R+SQR(R*R-1))/PI
250 SIG=NBAR/SQR(A*A+(NBAR-.5)^2)
260 REM COMPUTE CURRENTS
270 REM ......BY APERTURE SAMPLING METHOD
280 IEVEN=0
290 IF INT(M/2)=M/2 THEN IEVEN=1
300 FOR I=1 TO (M+1)/2
310 ZN=(I-N/2-1)*D
320 IA(I)=1
330 FOR P=1 TO NBAR-1
340 CT=COS(2*PI*P*ZN/L)
350 REM COMPUTE F FUNCTION
360 NF=NBAR-1
370 GOSUB 1740
380 F=NF*NF
390 NF=NBAR-1+P
400 GOSUB 1740
410 F=F/NF
420 NF=NBAR-1-P
430 GOSUB 1740
440 F=F/NF
450 FOR MM=1 TO NBAR-1
460 UM=MM*PI
470 IF MM<NBAR THEN UM=PI*SIG*SQR(A*A+(MM-.5)^2)
480 F=F*(1-(PI*P/UM)^2)
490 NEXT MM
500 IA(I)=IA(I)+2*F*CT
510 NEXT P
520 NEXT I
530 REM FILL OTHER HALF OF IA
540 FOR I=1+INT((M+1)/2) TO M
550 IA(I)=IA(M-I+1)
560 NEXT I
570 PRINT
580 REM .....BY NULL MATCHING METHOD
590 REM FILL WR,WI WITH COMPLEX ROOTS
600 FOR MM=1 TO (M+1)/2
610 UM=MM*PI
620 IF MM<NBAR THEN UM=PI*SIG*SQR(A*A+(MM-.5)^2)
630 WR(2*MM-1)=COS(2*UM/M)
640 WI(2*MM-1)=SIN(2*UM/M)
650 WR(2*MM)=WR(2*MM-1)
660 WI(2*MM)=-WI(2*MM-1)
670 NEXT MM
680 FOR I=0 TO N+1
690 INR(I)=0
700 INI(I)=0
710 NEXT I
720 INR(1)=1
730 FOR P=1 TO N
740 REM SHIFT DOWN ALL ENTRIES AND TOP WITH 0
750 FOR I=P+1 TO 1 STEP -1
760 INR(I)=INR(I-1)
770 INI(I)=INI(I-1)
780 NEXT I
790 REM ADD P-TH ROOT*LOWER VALUE
800 FOR I=1 TO P+1
810 SR=WR(P)*INR(I+1)-WI(P)*INI(I+1)
820 SI=WR(P)*INI(I+1)+WI(P)*INR(I+1)
830 INR(I)=INR(I)+SR
840 INI(I)=INI(I)+SI
850 NEXT I
860 NEXT P
870 FOR I=1 TO N
880 INR(I)=SQR(INR(I)^2+INI(I)^2)
890 NEXT I
900 REM NORMALIZE
910 MM=INT((M+1)/2)
920 IAM=IA(MM)
930 INM=INR(MM)
940 PRINT " APERTURE NULL"
950 PRINT "ELEMENT SAMPLING (dB) MATCHING (dB)"
960 FOR I=1 TO M
970 IAT=IA(I)/IAM
980 INS=INR(I)/INM
990 D1=20*FNLOG10(IAT)
1000 D2=20*FNLOG10(INS)
1010 PRINT USING " ## #.#### ###.## #.#### ###.##";I,IAT,D1,INS,D2
1020 NEXT I
1030 PRINT
1040 REM COMPUTE BEAMWIDTH
1050 AC1=LOG(R+SQR(R*R-1))^2
1060 AC2=LOG(R/1.414+SQR(R*R/2-1))^2
1070 X=SIG*SQR(AC1-AC2)/(PI*L)
1080 BW=360*ATN(X/SQR(1-X*X))/PI
1090 DT=101.5/BW
1100 DTDB=10*FNLOG10(DT)
1110 PRINT USING "THE DIRECTIVITY IS ##.## dB";DTDB
1120 PRINT USING "THE 3-dB BEAMWIDTH IS ###.# degrees";BW
1130 PRINT
1140 COLOR 4,0
1150 INPUT "PLOT PATTERN(Y,N)";IP$
1160 IF IP$<>"N" THEN GOTO 1200
1170 INPUT "CONTINUE(Y,N)";IP$
1180 IF IP$="N" THEN GOTO 1820
1190 GOTO 70
1200 SCREEN 0,1
1210 CLS
1220 INPUT "USING APERTURE SAMPLING(A) OR NULL MATCHING(N) CURRENTS";IP$
1230 IF NOT(IP$="A" OR IP$="N") THEN GOTO 1220
1240 REM PLOT PATTERN
1250 SCREEN 2,0
1260 VIEW (262,3)-(638,182)
1270 WINDOW (-2,-56)-(92,0)
1280 LOCATE 1,1
1290 IF IP$="A" THEN PRINT "APERTURE SAMPLING CURRENTS"
1300 IF IP$="N" THEN PRINT "NULL MATCHING CURRENTS"
1310 FOR J=0 TO 90 STEP 10
1320 LINE (J,-50)-(J,-51)
1330 NEXT J
1340 LINE (90,-50)-(0,-50)
1350 FOR J=0 TO -50 STEP -10
1360 LINE (0,J)-(-2,J)
1370 NEXT J
1380 LINE (0,0)-(0,-50)
1390 LOCATE 23,55
1400 PRINT "THETA"
1410 FOR I=0 TO 5
1420 LOCATE 1+4*I,30
1430 PRINT USING "###";-10*I
1440 NEXT I
1450 LOCATE 11,28: PRINT "dB"
1460 LOCATE 22,35
1470 PRINT"0 10 20 30 40 50 60 70 80 90"
1480 KD=2*PI*D
1490 DTR=PI/180
1500 N=INT(M/2)
1510 NL=N
1520 IF IEVEN=0 THEN NL=N+1
1530 PSET (0,0)
1540 FOR TH=0 TO 90
1550 STH=SIN(TH*DTR)
1560 F=0
1570 FOR J=1 TO NL
1580 IF IEVEN=0 THEN C=J-1
1590 IF IEVEN=1 THEN C=J-.5
1600 IF IP$="A" THEN CI=IA(NL+1-J)
1610 IF IP$="N" THEN CI=INR(NL+1-J)
1620 IF J=1 AND IEVEN=0 THEN CI=CI/2
1630 F=F+CI*COS(C*KD*STH)
1640 NEXT J
1650 F=ABS(F)
1660 IF TH=0 THEN FMAX=F
1670 F=F/FMAX
1680 IF F<.00316 THEN F=.00316
1690 F=20*FNLOG10(F)
1700 LINE -(TH,F)
1710 NEXT TH
1720 LOCATE 2,1
1730 GOTO 1150
1740 REM SUBROUTINE FOR NF FACTORIAL
1750 NFAC=1
1760 IF NF<=1 THEN GOTO 1800
1770 FOR N1=1 TO NF
1780 NFAC=NFAC*N1
1790 NEXT N1
1800 NF=NFAC
1810 RETURN
1820 SCREEN 0,1
1830 COLOR 7,0
1840 KEY ON
1850 END