-
Notifications
You must be signed in to change notification settings - Fork 52
/
functionZFBF.m
38 lines (30 loc) · 1.08 KB
/
functionZFBF.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
function wZFBF = functionZFBF(H,D)
%Calculates the zero-forcing beamforming (ZFBF) vectors for a
%scenario where all or a subset of antennas transmit to each user.
%
%This is version 1.0.
%
%INPUT:
%H = Kr x Kt*Nt matrix with row index for users and column index
% transmit antennas
%D = Kt*Nt x Kt*Nt x Kr diagonal matrix. Element (j,j,k) is one if j:th
% transmit antenna can transmit to user k and zero otherwise
%
%OUTPUT:
%wZFBF = Kt*Nt x Kr matrix with normalized ZFBF
%Number of users
Kr = size(H,1);
%Total number of antennas
N = size(H,2);
%If D matrix is not provided, all antennas can transmit to everyone
if nargin<2
D = repmat( eye(N), [1 1 Kr]);
end
%Pre-allocation of MRT beamforming
wZFBF = zeros(size(H'));
%Computation of ZFBF, based on Definition 3.4
for k = 1:Kr
effectivechannel = (H*D(:,:,k))'; %Effective channels
channelinversion = effectivechannel/(effectivechannel'*effectivechannel); %Compute zero-forcing based on channel inversion
wZFBF(:,k) = channelinversion(:,k)/norm(channelinversion(:,k)); %Normalization of zero-forcing direction
end