MATLAB: How to find the roots of a laguerre polynomial from the polynomial itself and not from its coefficients

laguerre polynomialrrots of a polynomial

for i=1:n
f(i)=laguerreL(i,-1/2,x);
p=coeffs(f(i));
r0=roots(p);
end
In the above code it is not possible to find the roots of all f(i)'s(i ranging from 1 to n) .Moreover ,to use matrix for storing the co-efficients ,we don't know the no of co-efficients of a polynomial f(i) for each iteration.Is there any other alternative for finding the roots of all f(i)'s.

Best Answer

n = 5;
syms x
for i=1:n
f(i) = laguerreL(i,-1/2,x);
p = coeffs(f(i));
r0{i} = roots(p);
end
Related Question