⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 gfplus.m

📁 数字通信第四版原书的例程
💻 M
字号:
function k = gfplus(i,j,alpha,beta)
%GFPLUS Adds two GF(2^M) elements.
%       C = GFPLUS(A, B, ALPHA, BETA) adds two GF(2^M) element A and B results
%       in C, i.e., a^C = a^A + a^B, where [a^-Inf, a^0,...a^(M-2)] is the 
%       exponential representation of all elements in GF(2^M). The variable
%       ALPHA is an integer vector that contains the decimal form of the
%       tuple of all elements in GF(2^M). ALPHA can be computed by
%       ALPHA = GFTUPLE([-1 : 2^M-2]', M) * 2.^[0 : M - 1]'
%       BETA is the index-contents reverse of ALPHA, which can be obtained by
%       BETA(ALPHA + 1) = 0 : 2^M - 1;
%       ALPHA and BETA must be length 2^M vectors. This function is the same
%       as GFADD but much faster in the computation.
%
%       See also: GFADD, GFMUL, GFSUB, GFDIV.

%       Wes Wang 7/10/95, 10/7/95.
%       Copyright (c) 1995-96 by The MathWorks, Inc.
%       $Revision: 1.1 $  $Date: 1996/04/01 17:59:07 $


if any(i(:)<-1)
    tmp = find(i < -1);
    i(tmp) = -ones(length(tmp), 1);
end;

if any(j(:)<-1)
    tmp = find(j < -1);
    j(tmp) = -ones(length(tmp), 1);
end;

N = length(alpha);

%k = beta(flxor(alpha(i+2),alpha(j+2))+1)-1;
%k = beta(rem(flxor(alpha(rem(i, N-1) +2),alpha(rem(j, N-1) + 2)), N-1) + 1 ) - 1;
k = beta(flxor(alpha(rem(i, N-1) +2),alpha(rem(j, N-1) + 2)) + 1 ) - 1;

if any(k < 0)
    tmp = find(k < 0);
    k(tmp) = -Inf * ones(length(tmp), 1);
end;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -