Maximization of gain of array antennas