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

📄 htruthtb.m

📁 数字通信第四版原书的例程
💻 M
字号:
function trt = htruthtb(g)
%HTRUTHTB Generates a Hamming code truth table.
%       TRT = HTRUTHTB(G) produces a truth table for single error-correction
%       code. The size of G has the dimension defined in Hamming coding.
%
%       See also: HAMMGEN, DECODE.

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

[k, n] = size(g);
if k > n
    g = g';
     [k, n] = size(g);
end;

if max(max(eye(k) - g(:, n-k+1:n))) > 0
    h = g;
else
    h = gen2par(g);
    [k, n] = size(h);
end;

if max(max(eye(k) - h(:, 1:k))) > 0
    error('The input matrix is neither generator or parity-check matrix')
end;

%construct a truth table
trt = [zeros(1, n); eye(n)];
hh = [zeros(1,k); fliplr(h')];

% reorder the truth table based on h.
hh = bi2de(hh)+1;
%trt(hh,:) = trt(hh, :);
trt(hh,:) = trt;

%--end of htruthtb--

⌨️ 快捷键说明

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