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

📄 gftrunc.m

📁 数字通信第四版原书的例程
💻 M
字号:
function c = gftrunc(a, tp)
%GFTRUNC Truncates redundant part of a GF(P) polynomial.
%       C = BFTRUNC(A) removes the zero coefficient from the highest order
%       terms from a GF(P) polynomial A. If the highest order term coefficient
%       is a non-zero number, the output of this function equals the input.
%       The resulted GF(P) polynomial C is the same as A with a shortened
%       form.
%
%       The GF(P) polynomial A is in ascending order, i.e.,
%         A = [a_0, a_1, a_2,..., a_(n-1), a_n] represents
%         A(X) = a_0 + a_1 X + a_2 X^2 +...+ a_(n-1) X^(n-1) + a_n X^n
%       a_i must be an element in GF(P).
%
%       See also GFADD, GFDIV, GFTUPLE

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

if isempty(a) 
      c = a;
else
    cut_0 = 1;
    if nargin > 1
        if length(tp) > 1
            cut_0 = 0;
        end;
    end;
    if cut_0
        ind = find(a ~= 0);
    else
        ind = find(a >= 0);
    end;
  if ~isempty(ind)
                c = a(1 : ind(length(ind)));
    else
        if cut_0
                    c = 0;
        else
            c = -Inf;
        end;
     end;
end;

%--end of GFTRUNC--

⌨️ 快捷键说明

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