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
