When operating in the class 'SINGLE', the largest floating point number representable on the computer is 3.4028e+038 which is given by 'REALMAX('SINGLE')'. While calculating the roots of the given polynomial, one of the coefficients exceeds this largest floating point number and overflows to Inf. This results in the "error using ==>eig NaN or Inf prevents convergence" message being reported.
1. If it is required to work in single precision numbers, one workaround would be to convert the coefficients of the polynomial to double, find the roots and convert them back to single class as indicated below:
r = single(roots(double(c)))
The other workarounds involve using functions other than ROOTS to find the roots of a polynomial as listed below:
2. Use the SOLVE function (listed under Symbolic Math Toolbox):
y = solve([ x.^6 x.^5 x.^4 x.^3 x.^2 x.^1 1 ]*c')
3. Use the FMINSEARCH function (listed under Optimization Toolbox) to find the minima of the square of the polynomial:
y = fminsearch(@(x) ([ x.^6 x.^5 x.^4 x.^3 x.^2 x.^1 1 ]*c').^2 , 1 )
4. Other options include using the FSOLVE or FZERO functions to find the minima based on the objective function.