polyadd.m

来自「内模控制器(IMC)工具箱。包括参数整定、PID控制器参数转换等」· M 代码 · 共 25 行

M
25
字号
function AplusB=polyadd(A,B)
% POLYADD is a function that adds two polynomials.
%     Vectors A and B represent the coefficients of
%     polynomials A and B in descending powers of 
%     an independent variable.
%     [AplusB]=POLYADD(A,B)  where the AplusB vector contains 
%     resulting polynomial coefficients in descending 
%     powers of an independent variable.
% by Mario Laiseca 1993

if length(A) > length(B)
   fil=zeros(1,length(A)-length(B));
   B = [fil B];
elseif length(B) > length(A)
   fil=zeros(1,length(B)-length(A));
   A = [fil A];
end   
AplusB =A + B;
while ~isempty(AplusB) & AplusB(1)==0
   AplusB(1)=[];
end



⌨️ 快捷键说明

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