 # MATLAB代做|FPGA代做--协作MIMO球形译码算法

### 时间：2018-10-24 15:14:25 点击： 核心提示：-协作MIMO球形译码算法...
function r = sphdec(H, y, symbset, radius)
%
%  SPHDEC: sphere decoder for linear STBC
%
%  R = SPHDEC(H, Y, SYMBSET, RADIUS)
%
%  H:        equivalent channel matrix
%  SYMBSET:  constellation
%
%  author:  Xiaoyong Guo
%  website: http://www.wordeazy.com
%
%  of this program. Please Send BUG report to
%
%           guo.xiaoyong@gmail.com
%
%  COPYRIGHT (c) 2006-2009,  Xiaoyong Guo
%

if nargin == 3
end

if size(H, 1) < size(H, 2)
H = [H; zeros(size(H, 2) - size(H, 1), size(H, 2))];
end

[Q, R] = qr(H, 0);
z = Q'*y;
n = size(H,2);

% add examine this variable before make it global
global RETVAL;
global TMPVAL;
global SYMBSETSIZE;
global SEARCHFLAG;

RETVAL        = zeros(n, 1);
TMPVAL        = zeros(n, 1);
SYMBSETSIZE   = length(symbset(:));
SEARCHFLAG    = 0;

sphdec_core(z, R, symbset, n, 0);

if SEARCHFLAG > 0
r = RETVAL;
else
r = 0;
end

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function sphdec_core(z, R, symbset, layer, dist)

global RETVAL;
global TMPVAL;
global SYMBSETSIZE;
global SEARCHFLAG;

if (layer == 1)
for ii = 1:SYMBSETSIZE
TMPVAL(1) = symbset(ii);
d = abs(z(1) - R(1,:)*TMPVAL)^2 + dist;
RETVAL        =  TMPVAL;
SEARCHFLAG    =  SEARCHFLAG + 1;
end
end
else
for ii = 1:SYMBSETSIZE
TMPVAL(layer) = symbset(ii);
d = abs(z(layer) - R(layer,[layer:end])*TMPVAL(layer:end))^2 + dist;
sphdec_core(z, R, symbset, layer-1, d);
end
end
end

QQ ：1224848052 • ##### 您是如何找到本站的？
• 百度搜索
• 查阅资料过程中
• 论坛发现
• 百度贴吧发现
• 朋友介绍 ###### 相关评论 ###### 发表我的评论                              • 大名：
• 内容： 