All problems
Beamforming Gain
Problem
Return the beamforming gain of weights w and real channel h: (sum_i w_i * h_i)^2. This is the received power with unit transmit power when the beamformer is matched to the channel.
Hint
Matched-filter weights maximize this gain when they align with the channel.
Test cases
case 1
in: [[1,1],[1,1]]
expected: 4
case 2
in: [[0.5,0.5],[1,1]]
expected: 1
case 3
in: [[1,0],[1,5]]
expected: 1
case 4
in: [[0.6,0.8],[0.6,0.8]]
expected: 1
Starter codePython
def beamforming_gain(weights, channel):
# Your code here
pass4 test cases · run your code against them in the editor