function c = poly_add(a,b)

% calcola la somma dei polinomi a e b
% A(z) = a(1) + a(2)*z + a(3)*z^2 + ... a(N)*z^N-1
% B(z) = b(1) + b(2)*z + b(3)*z^2 + ... b(M)*z^M-1
N = numel(a);
M = numel(b);
L = max(N,M);

c = zeros(1,L);
c(1:N) = a;
c(1:M) = c(1:M) + b;

n = L;
while c(n) == 0
    if n > 1
        n = n - 1;
    else
        break
    end
end
c = c(1:n);
