-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathget_mimo3_SNRs_sm.m
52 lines (46 loc) · 1.47 KB
/
get_mimo3_SNRs_sm.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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
%GET_MIMO3_SNRS_SM Calculates the MIMO3 SNRs for a scaled CSI matrix.
% Note that the matrix is expected to have dimensions M x N x S, where
% M = # TX antennas
% N = # RX antennas
% S = # subcarriers
% This version takes into account the spatial mapping performed by Intel NICs.
%
% (c) 2008-2011 Daniel Halperin <[email protected]>,
% Wenjun Hu
%
function ret = get_mimo3_SNRs_sm(csi)
error(nargchk(1,1,nargin));
% Make sure at least 3 TX and RX antennas
[M, N, S] = size(csi);
if (M < 3)
error('CSI matrix must have at least 3 TX antennas');
end
if (N < 3)
error('CSI matrix must have at least 3 RX antennas');
end
% Since the incoming CSI is scaled to single-TX reduce by 3 for 3 streams
%
% Take away 4.5 dB (Intel-specific version of "1/3" ~ -4.77 dB)
csi = csi / sqrt(dbinv(4.5));
% Divide power by 3 (Real version of 3)
% csi = csi / sqrt(3);
ret = zeros(1,3,S);
for i = 1:S
ret(1,:,i) = mimo3_mmse_sm(squeeze(csi(:,:,i)));
end
return;
end
% Compute the MMSE stream SNRs of a single channel matrix
function ret = mimo3_mmse_sm(csi_i)
% Load and apply SM matrices
sm_matrices;
csi = apply_sm(csi_i, sm_3_20);
% We want
% H' * H + I
% but, since csi = H transposed, we instead use
% conj(csi) * csi.'
M = inv(conj(csi) * csi.' + eye(3));
ret = 1 ./ diag(M) - 1;
% ret is real. Really.
ret = real(ret);
end