Documente Academic
Documente Profesional
Documente Cultură
LABORATORY ACTIVITY #3
Polynomials and Partial Fraction Expansion
I. Learning Objectives:
At the end of the laboratory activity, the students should be able to:
1. To describe polynomials in MATLAB
2. To implement polynomials addition, subtraction, scalar multiplication, multiplication, and division with
MATLAB
3. To determine the roots of polynomials
4. To implement partial fraction expansion with MATLAB
II. Primer:
A. Polynomials
MATLAB is capable working with polynomials which are used in many advanced courses and applications
in engineering. To describe a polynomial in MATLAB with a row vector whose elements are the polynomials
coefficients, consider: f ( x) 4 x3 8x 2 7 x 5
Polynomial Algebra
1. Addition and Subtraction
To add and/or subtract two polynomials, add/ subtract the arrays that describe their coefficients. If the
polynomials are of different degrees, add zeros to the coefficient array of the lower degree polynomial.
Consider: f ( x) 10x3 6x 2 2x 10 and g( x) 5x 2 4 x 3 ,
4. Polynomial Roots
The command roots(a) computes an array containing the roots of a polynomial specified by the
coefficient array a. The result is a column array that contains the polynomials roots. Consider
() = 3 7 2 + 40 34.
6. The polyval(a,x) function evaluates a polynomial at specified values of its independent variable x,
which can be a matrix or a vector. The polynomials coefficient array is a
Consider f ( x) 9 x3 5x 2 3x 7 . To evaluate at the points x = 0, 2, 4, 6, 8, 10, type
Consider:
B( s) Num b0 s n b1 s n 1 ...... bn
n
A( s ) Den s a1 s n 1 ...... a n
The command [r,p,k] = residue(Num,Den) finds the residue (r), poles (p), and direct terms (k) of a
partial fraction expansion.
B( s ) r (1) r ( 2) r(n)
........ k ( s)
A( s ) s p(1) s p( 2) s p( n )
Example:
Consider:
B( s ) 2 s 3 5s 2 3s 6
A( s ) s 3 6s 2 11s 6
The MATLAB program:
B( s ) 6 4 3
2
A( s) s 3 s 2 s 1
A. Polynomials
() = 4 3 3 6 5
() = 3 + 2 2 + 4
() = 4 4 3 3 7 2 + 2 + 4
() = 2 3 + 3 2 2 + 5