In Problem 44259 I asked you to multiply two multidimensional polynomials that were represented by an array that is a generalization of the way MATLAB handles one-variable polynomials. However, that representation has at least two problems:
Here, we will represent a polynomial as a sum of monomials. For example, the polynomial p(x,y) = 2*x^5*y + 3*x*y^5 is the sum of two monomials in x and y. We will represent this by exponents, a matrix of integers with each row representing the exponents of one monomial (including zeros); and a column vector coefficients for the coefficient of each monomial. For p(x,y), these are
exponents = [5 1; 1 5]; coefficients = [2; 3];
Let's hedge our bets, though, and create a function that converts this form to the array form. Your task is to create a function
function c = coeffArray(exponents,coefficients)
that inputs the exponents and coefficients and returns an array as defined in Problem 44259.