gftrunc.m
来自「经典通信系统仿真书籍《通信系统与 MATLAB (Proakis)》源代码」· M 代码 · 共 47 行
M
47 行
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 + =
减小字号Ctrl + -
显示快捷键?