## Finding Roots of Polynomials in MATLAB

For this task, MATLAB provides a useful function called ROOTS that finds the solution x of the equation y = f(x) = 0 where f(x) is a polynomial. First, lets define a polynomial in array form. x^2-x+3 translates to

To find the roots simple do

In this case, the roots were complex numbers. […]

## Numerical Integration in MATLAB

QUAD and QUAD8 functions are used for numerical integration in MATLAB. QUAD is based on adaptive-recursive Simpson’s rule, whereas QUAD8 is based on adaptive-recursive Newton-Cotes eight-panel rule. Their syntax is the same and like this QUAD/QUAD8(func, A, B, T) func as you can guess is the function name for desired function to be integrated. A […]

## Evaluating Polynomials in MATLAB

MATLAB provides the useful function polyval for this task. Its syntax is polyval(p,x) where p is a representation of the polynomial as a row array. (i.e. x^2+2x+3 is [1 2 3] aka coefficient array). The variable x is the array where you want to evaluate the p at. x can also be a single value. […]

## Palindrome Checker in Matlab

source:rosettacode.org

## Generating Spirographs in Matlab

Sample: spirograph