Example A.1: Find The Roots of The Polynomial
Example A.1: Find The Roots of The Polynomial
1
Find the roots of the polynomial
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
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
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
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
Analisa :
Example A.7
Let
p3 = x7 – 3x5+5x3+7x+9
and
p4 = 2x6 – 8x5+4x2+10x+12
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
Analisa :
Example A.8
Let
p5 = 2x6 – 8x4+4x2+10x+12
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
Analisa :