I have written a function that creates a matrix based on a polynomial of a given degree. I will ultimately use this to fit data, but the problem I am having is that I can not find a good way to create a coefficient matrix, such as:
My polynomial matrix: [1 x x^2 ... x^n] where n is the degree. The matrix consists of a number of these row entries, and what I want to do is to add coefficients to make it: [c_1 c_2*x ... c_n*x^n].
Any help would be greatly appreciated.
So you want to do coefficient-wise multiplication between the row of your polynomial m-by-n matrix M (where m is the number of entries) and a 1-by-n vector C ?
Something like that ? The part in parenthesis creates a m-by-n matrix repeating the row of coefficient, and the .* is the coefficient-wise multiplication.