Calculating Beam Width

The question came up during the November 6, 2008 SVWUX meeting about how to calculate the beam width in miles at a given distance and angle for an antenna. I wrote this script during the meeting to calculate the result.

#!/usr/bin/perl
# beamwidth calculator
# by Ian Kluft
# written at the Nov 6, 2008 SVWUX meeting to answer a question

use strict;
use Math::Trig;
use Getopt::Long;

my $angle_deg = -1;
my $dist_mi = -1;
my $result = GetOptions (
        "angle:i" => \$angle_deg,
        "dist:i" => \$dist_mi );
if ( $angle_deg < 0 or $dist_mi < 0 ) {
        die "usage: $0 --angle=xx --dist=yy\n";
}

my $angle_triangle = $angle_deg/2;
my $angle_rad = deg2rad( $angle_triangle );
my $width = tan( $angle_rad ) * $dist_mi;
my $beamwidth = $width * 2;

printf "beamwidth for %d degrees at %3.1f miles is %4.2f miles\n",
        $angle_deg, $dist_mi, $beamwidth;

-- IanKluft - 07 Nov 2008

Topic revision: r1 - 2008-11-06 - 21:48:32 - IanKluft
 
This site is powered by the TWiki collaboration platformCopyright © by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding SVWUX? Send feedback