MATLAB: M-file function for solving high order polynomial equation

solve

I want to build for solving polynomial equation for high order (example x^202+x^102+x^52+100) and apply other problem.
I write m-file in this form.
function [eig] = solvepoly(chareq)
eq = 'chareq';
eig = solve(eq);
end
Then I use this function. The answer isn't correct.
>> [eig] = solvepoly(@(x) x^2+2*x+1)
eig =
0
But I use this command in command window. I get this answer.
>> eq = 'x^2+2*x+1'; >> eig = xolve(eq)
eig =
-1 -1
Help me please.

Best Answer

This is easier:
syms x
p = x^202+x^102+x^52+100;
r = roots(sym2poly(p));
The ‘r’ variable will have all 202 roots.