  Gbps wireless transmission over long distance at high frequency bands has
great potential for 5G and beyond, as long as high beamforming gain could be
delivered at affordable cost to combat the severe path loss. With limited
number of RF chains, the effective beamwidth of a high gain antenna will be
"widened" by channel angular spread, resulting in gain reduction. In this
paper, we formulate the analog beamforming as a constrained optimization
problem and present closed form solution that maximizes the effective
beamforming gain. The optimal beam pattern of antenna array turns out to
"match" the channel angular spread, and the effectiveness of the theoretical
results has been verified by numerical evaluation via exhaustive search and
system level simulation using 3D channel models. Furthermore, we propose an
efficient angular spread estimation method using as few as three power
measurements and validate its accuracy by lab measurements using a
$16{\times}16$ phased array at 28 GHz. The capability of estimating angular
spread and matching the beam pattern on the fly enables high effective gain
using low cost analog/hybrid beamforming implementation, and we demonstrate a
few examples where substantial gain can be achieved through array geometry
optimization.
