Canadian TV, Computing and Home Theatre Forums banner

1 - 3 of 3 Posts

·
Registered
Joined
·
119 Posts
Discussion Starter #1
This post will show hard numbers on several of the
do it yourself uhf (no reflector) antennas.


Code:
Antenna                     Standard      Average Gain DB
                            Deviation       Per Channel

Flat Gain No Hybrid            .38             12.34
Centipede-4 Repack             .21             12.28
Flat Gain Hybrid               .45             12.07
SuperQuad Repack               .44             11.76
Mclapp 9.5 x 9 Repack          .59             11.51
SBGH Repack                    .70             10.47

With smaller standard deviations, the gain curve is more flat.

Hope this helps you decide, on which uhf antenna to build.


Have fun building antennas!
 

·
Registered
Joined
·
119 Posts
Discussion Starter #3 (Edited)
Here is the program code in freebasic for finding the average channel gain

It creates a text file with the standard deviation & average gain.

For those who don't want to bother with compiling this code, here is the executable.

ChanAveGain.exe

Freebasic code:

Code:
#LANG "fblite"

DECLARE Function Remain$( ByRef nStart%, ByRef sMainString$, ByRef sMatchPattern$)
DECLARE Function Extract$(nStart%, sMainString$, sMatchPattern$)

DIM ChannelGain!(14 TO 36,2)

DECLARE SUB Incr(A%)


' Enter filename

Cmd$ = COMMAND$ 
IF Cmd$ = "?" OR Cmd$ = "-h" THEN
        PRINT "ChanAveGain Filename"
        SLEEP
        END
END IF    

OPEN Cmd$ FOR INPUT AS #1
InputFile$ = Extract$(1,Cmd$,".")

OPEN InputFile$ + "-Freq-Chan-Avg.txt" FOR OUTPUT AS #2

PRINT "Getting Average channel gain"

PRINT "Working"

FOR I% = 14 TO 36
    INCR TotalChannels%
    DO
        position& = SEEK(1)
        LINE INPUT #1,Thisline$
        FirstChar$ = LEFT$(Thisline$, 1)
    LOOP UNTIL FirstChar$ <> "#"


    SEEK #1,position&

    TotalChannelGain! = 0

    FOR J% = 1 TO 6
        LINE INPUT #1,Thisline$
        Gain$ = TRIM$(REMAIN$(1,Thisline$,CHR$(9)))
        TotalChannelGain! = TotalChannelGain! + VAL(Gain$)
    NEXT J%

    TotalChannelGain! = TotalChannelGain!/6

    ChannelGain!(I%,1) = TotalChannelGain!

    ChannelAvgGain! = ChannelAvgGain! + TotalChannelGain!
NEXT I%

ChannelAvgGain! = ChannelAvgGain!/TotalChannels%

TotalChannels% = 0
Variance! = 0

FOR K% = 14 TO 36
    INCR TotalChannels%
    ChannelGn! = ChannelGain!(K%,1)
    Variance! = Variance! + (ChannelGn! -ChannelAvgGain!)^2
    ChannelGain!(K%,2) = (ChannelGn!-ChannelAvgGain!)^2
NEXT K%

Variance! = Variance!/TotalChannels%

StandardDeviation! = SQR(Variance!)
PRINT #2,"Standard Deviation = ";TRIM$(STR$(StandardDeviation!));"    Average Gain = ";TRIM$(STR$(ChannelAvgGain!))
PRINT
PRINT "Standard Deviation = ";TRIM$(STR$(StandardDeviation!));"    Average Gain = ";TRIM$(STR$(ChannelAvgGain!))
SLEEP
END

SUB Incr(A%)   
A% = A% + 1
END SUB

Function Remain$( nStart%, sMainString$, sMatchPattern$)

    nLenMain% = Len(sMainString$)
   
    If (nStart% = 0) Or (nStart% > nLenMain%) Then Return ""
    If nStart% < 0 Then nStart% = nLenMain% + nStart% + 1
   
    i% = Instr(nStart%, sMainString$, sMatchPattern$)
    If i% Then
       Function = Mid$(sMainString$,i%+Len(sMatchPattern$))
    Else
       Function = ""
    End If   
End Function

Function Extract$(nStart%, sMainString$, sMatchPattern$)

    nLenMain% = Len(sMainString$)             
   
    if (nStart% = 0) Or (nStart% > nLenMain%) Then Return ""
    If nStart% < 0 Then nStart% = nLenMain% + nStart% + 1
   
    i% = Instr(nStart%, sMainString$, sMatchPattern$)
    If i% Then
       Function = Mid$(sMainString$, nStart%, i%-nStart% )
    Else
       Function = Mid$(sMainString$, nStart%)
    End If
End Function
 
1 - 3 of 3 Posts
Top