0% found this document useful (0 votes)
81 views

Example A.1: Find The Roots of The Polynomial

The document provides examples of using MATLAB to perform operations on polynomials such as finding roots, computing coefficients given roots, evaluating polynomials at points, multiplying polynomials using convolution, dividing polynomials using deconvolution, and computing the derivative of a polynomial. Each example shows the MATLAB code used, the output, and a summary analysis. Key functions used include roots(), poly(), polyval(), conv(), deconv(), and polyder().

Uploaded by

Badrul Munier
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
81 views

Example A.1: Find The Roots of The Polynomial

The document provides examples of using MATLAB to perform operations on polynomials such as finding roots, computing coefficients given roots, evaluating polynomials at points, multiplying polynomials using convolution, dividing polynomials using deconvolution, and computing the derivative of a polynomial. Each example shows the MATLAB code used, the output, and a summary analysis. Key functions used include roots(), poly(), polyval(), conv(), deconv(), and polyder().

Uploaded by

Badrul Munier
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 8

Example A.

1
Find the roots of the polynomial

p1(x) = x4 – 10x3 + 35x2 – 50x + 24

Formula:
p1=[1 −10 35 −50 24] % Specify and display the coefficients of p1(x)
roots_ p1=roots(p1) % Find the roots of p1(x)

We observe that MATLAB displays the polynomial coefficients as a row vector, and the roots as
a column vector.

Run Program :
p1 =

1 -10 35 -50 24

roots_p1 =

4.0000
3.0000
2.0000
1.0000

Analisa :
Example A.2
Find the roots of the polynomial

p2(x) = x5 – 7x4 + 16x2 + 25x + 52

Formula:
There is no cube term; therefore, we must enter zero as its coefficient. The roots are found with
the statements below, where we have defined the polynomial as p2, and the roots of this
polynomial as roots_ p2. The result indicates that this polynomial has three real roots, and two
complex roots. Of course, complex roots always occur in complex conjugate* pairs.
p2=[1 −7 0 16 25 52]

roots_ p2=roots(p2)

Run Program :
p2 =

1 -7 0 16 25 52

roots_p2 =

6.5014
2.7428
-1.5711
-0.3366 + 1.3202i
-0.3366 - 1.3202i

Analisa :
Example A.3
It is known that the roots of a polynomial are 1, 2, 3, and 4. Compute the coefficients of this
polynomial.

Formula:
r3=[1 2 3 4] % Specify the roots of the polynomial
poly_r3=poly(r3) % Find the polynomial coefficients

We observe that these are the coefficients of the polynomial of Example A.1.

Run Program :
r3 =

1 2 3 4

poly_r3 =

1 -10 35 -50 24

Analisa :
Example A.4
It is known that the roots of a polynomial are –1, –2, –3, 4+j5 and 4–j5. Find the coefficients
of this polynomial.

Formula:
r4=[ −1 −2 −3 −4+5j −4−5j ]
poly_r4=poly(r4)

Run Program :
r4 =
Columns 1 through 3
-1.0000 -2.0000 -3.0000

Columns 4 through 5
-4.0000 + 5.0000i -4.0000 - 5.0000i

poly_r4 =
1 14 100 340 499 246

Maka : p4(x) = X5 + 14X4+ 100X3+ 340X2 +499X+246

Analisa :
Example A.5
Evaluate the polynomial
p5(x) = x6 – 3x5+5x3 – 4x2+3x + 2
at x= –3

Formula:
p5=[1 −3 0 5 −4 3 2]; % These are the coefficients
val_minus3=polyval(p5, −3) % Evaluate p5 at x=−3; no semicolon is used here

The polyval(p,x) function evaluates a polynomial at some specified value of the independent
variable x.

Run Program :
val_minus3 =
1280

Analisa :
Example A.6
Let
p1 = x5 – 3x4+5x2+7x+9

and
p2 = 2x6 – 8x4+4x2+10x+12

Compute the product p1 ⋅ p2 using the conv(a,b) function.

Formula:
p1=[1 −3 0 5 7 9]; % The coefficients of p1
p2=[2 0 −8 0 4 10 12]; % The coefficients of p2
p1p2=conv(p1,p2) % Multiply p1 by p2 to compute coefficients of the product p1p2

Run Program :
p1p2 =
Columns 1 through 11
2 -6 -8 34 18 -24 -74 -88 78 166 174

Column 12
108

Maka : p1⋅ p2 = 2x11 – 6x10 – 8x9+34x8+18x7 – 24x6 –74x5–88x4+78x3+166x2+174x+108

Analisa :

Example A.7
Let
p3 = x7 – 3x5+5x3+7x+9

and
p4 = 2x6 – 8x5+4x2+10x+12

Compute the quotient p3 ⁄ p4 using the [q,r]=deconv(c,d) function.

Formula:
p3=[1 0 −3 0 5 7 9]; % The coefficients of p3
p4=[2 −8 0 0 4 10 12]; % The coefficients of p4
[q,r]=deconv(p3,p4) %

Run Program :
q=
0.5000

r=
0 4 -3 0 3 2 3

Maka : q = 0.5 r = 4x5 – 3x4 + 3x2 + 2x + 3

Analisa :

Example A.8
Let
p5 = 2x6 – 8x4+4x2+10x+12

Compute the derivative using the polyder(p) function.

Formula:
p5=[2 0 −8 0 4 10 12]; % The coefficients of p5
der_p5=polyder(p5) % Compute the coefficients of the derivative of p5

Run Program :
der_p5 =
12 0 -32 0 8 10

Maka : = 12x5 – 32x3+4x2+8x+10

Analisa :

You might also like