MATLAB: Interesting question: construct a polynomial and then evaluate it

degreepolynomialroot

In the normal polynomial root-finding, we could utilized the roots(x) function and passed a vector a x for root.
But what if we have some function:
where r is some fixed constant.
In such case, the roots function definitely could not used in this case, how can i supposed to construct such function and then find its root?
Thanks for your assistance.

Best Answer

Certainly roots() could be used.
t = a(:) .';
t(r, end) = 0;
t(end-r+1:end) = [];
coeff = fliplr( t );
sols = roots(coeff);