bchenco.m

来自「Proakis《contemporarycommunication system」· M 代码 · 共 30 行

M
30
字号
function code = bchenco(msg, n, k, pg);
%BCHENCO Encodes message signal using binary BCH code.
%       CODE = BCHENCO(MSG, N, K) encodes the K-column message MSG to N-column
%       codeword CODE by using BCH code method. 
%
%       CODE = BCHENCO(MSG, N, K, PG) specifies the generator polynomial PG
%       for the BCH code.
%

%       Wes Wang 8/3/94, 9/30/95
%       Copyright (c) 1995-96 by The MathWorks, Inc.
%       $Revision: 1.1 $  $Date: 1996/04/01 17:52:08 $

% routine check
if nargin < 3
    error('Not enough input variable');
end;
[n_msg, m_msg] = size(msg);
if m_msg ~= k
    error('The input dimension does not match the message length.')
end;

% code calculation.
if nargin < 4
    pg = bchpoly(n, k);
end;
[h, gen] = cyclgen(n, pg);
code = rem(msg * gen, 2);
%----- end of bchenco -----

⌨️ 快捷键说明

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