In this section we will see Matlab commands related to polynomials. Respectively:

**Introducing a Polynomial in Matlab**- Finding the roots of the polynomial in Matlab: Matlab roots command
- Adding Polynomials in Matlab
- Multiplying Polynomials in Matlab: Matlab conv command
- Obtaining a Polynomial with Known Roots in Matlab: Matlab poly command
- Finding the Characteristic Equation of a Matrix in Matlab: Matlab poly command
- Assigning value instead of Unknown in Polynomial in Matlab: Matlab polyval command
- Derivation of a Polynomial in Matlab: Matlab polyder command
- Integrating a Polynomial in Matlab: Matlab polyint command
- Polynomial Curve Fitting in Matlab Matlab polyfit command

**Introducing a Polynomial to Matlab**

$ latex P (s) = a s ^ 4 + b s ^ 3 + c s ^ 2 + d s + e

We will use the coefficients of the polynomial to introduce a polynomial of

If I define a line vector named ‘coefficient’, in Matlab this:

>> coefficient = [a b c d e]

I need to enter the form.

Thus, we will be able to easily perform operations such as finding the root of polynomials and multiplying them by using Matlab’s ready commands on the polynomial, where I enter the coefficients as line vectors.

Sample:

$ latex P (s) = s ^ 4 +2 s ^ 3 + s ^ 2 + 3 s + 6

a polynomial of the form:

>> coefficient1 = [1 2 1 3 6]

We can enter it from the Matlab command screen.

Finding Roots of Polynomial in Matlab:

We will use the ‘roots’ command to find the roots of the polynomial.

We can find the roots of the Polynomial in Matlab, where we previously assigned the coefficients to a line vector.

Matlab roots command

roots (coefficients) or cocci = roots (coefficients)

**Sample:**

$ latex P (s) = 1 s ^ (2) + 2 s +1

Finding the roots of the polynomial with Matlab.

>> coefficients = [1 2 1];

>> roots (coefficients)

ans =

-one

-one

Sample:

$ latex s ^ 4 – 6 s ^ 3 + 11 s ^ 2 – 6 s

Finding the roots of the polynomial in Matlab:

>> coefficients = [1-6 11 -6 0];

>> rootz= roots (coefficients)

cocci =

0

3.0000

2.0000

1.0000

As seen in this example, if desired, the roots of the polynomial can be assigned to a variable. Here it is assigned to the variable named ‘rootz’. The values of the polynomial are 0, 3, 2 and 1.