I'm looking for a built-in Matlab function that sums two polynomial.
Example:
p1(x) and p2(x) are represented in code standard Matlab vectors:
p1 = [500 400 300 200 100 50];
p2 = [3 2 1 5];
How do I sum these two polynomials to get ps(x) with using built-in Matlab function(s); without writing an explicit m-file function?
I sure hope there is a nicer way of doing it (I'd probably put this into a helper function), but this seems to work just fine:
[zeros(1, size(p1,2)-size(p2,2)) p2] + [zeros(1, size(p2,2)-size(p1,2)) p1]
ans =
500 400 303 202 101 55