find the roots of the polynomial in matlab

To find the roots of a polynomial in MATLAB, you can use the roots function. Here's an example showing how to find the roots of a polynomial with coefficients [1 3 -4]:

main.m
coefficients = [1 3 -4];
rootsOfPolynomial = roots(coefficients);
disp(rootsOfPolynomial);
91 chars
4 lines

In this example, coefficients represent the coefficients of the polynomial in descending order of powers. The roots function will return the roots of the polynomial.

related categories

gistlibby LogSnag