-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathhelperArrayInfo.m
More file actions
67 lines (56 loc) · 1.76 KB
/
helperArrayInfo.m
File metadata and controls
67 lines (56 loc) · 1.76 KB
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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
function [isTxURA,expFactorTx,isRxURA,expFactorRx] = helperArrayInfo(prm,varargin)
% Return whether Tx and Rx employ URA or not, with other information
%
% Supports MIMO-OFDM Examples.
% Copyright 2017 The MathWorks, Inc.
narginchk(1,2);
if nargin==2
chkFlag = varargin{1};
else
chkFlag = false;
end
if chkFlag
% Parameter checks
% numSTS
if (~ismember(prm.numSTS, [1 2 4 8 16 32 64]))
error(message('comm_demos:helperArrayInfo:invNumSTS'));
end
% numSTS and numTx
if (prm.numSTS > prm.numTx)
error(message('comm_demos:helperArrayInfo:NumSTSgtNumTx'));
end
if (floor(prm.numTx/prm.numSTS) ~= prm.numTx/prm.numSTS)
error(message('comm_demos:helperArrayInfo:InvExpFactor'));
end
% numSTS and numRx
if any(prm.numRx < prm.numSTSVec)
error(message('comm_demos:helperArrayInfo:numSTSgtNumRx'));
end
end
% Transmit end (Tx)
expFactorTx = prm.numTx/prm.numSTS;
if expFactorTx==1 || prm.numSTS==1 % ULA
% Use ULA if expFactorTx==1 or if prm.numSTS<2
isTxURA = false;
if prm.numTx==1
% Avoid the phased.ULA error for numElements==1
error(message('comm_demos:helperArrayInfo:NumTxEq1'));
end
else % URA
% Use URA if expFactorTx>1 and numSTS>1
isTxURA = true;
end
% Receive end (Rx), per user
expFactorRx = prm.numRx./prm.numSTSVec;
isRxURA = zeros(prm.numUsers, 1, 'logical');
for uIdx = 1:prm.numUsers
if floor(expFactorRx(uIdx))~=expFactorRx(uIdx) || expFactorRx(uIdx)==1 ...
|| prm.numSTSVec(uIdx)==1 % ULA
% Use ULA if expFactorRx==1 or expFactorRx is non-integer
isRxURA(uIdx) = false;
else % URA
% Use URA if expFactorRx>1 and an integer, and numSTS>1
isRxURA(uIdx) = true;
end
end
end