Professional Documents
Culture Documents
ACT3
ACT3
ACT3
LABORATORY ACTIVITY #3
Polynomials and Partial Fraction Expansion
I. Learning Outcomes:
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
b. MATLAB Codes:
1.
>> f=[1, -8, 0, -9, -6];
>> g=[0, 1, 1, -3, 1];
>> a=f+g
>> b=f-g
>> product=conv(f,g)
>> quotient=deconv(f,g)
3.
>> f=[1, -8, 0, -9, -6];
>> g=[0, 1, 1, -3, 1];
>> h=[3, -8, -37, 2, 4];
>> p=[0, 2, 3, -2, 5];
>> roots(f)
>> roots(g)
>> roots(h)
>> roots(p)
4.
>> poly1=poly(rf);
>> poly2=poly(rg);
>> poly3=poly(rh);
>> poly4=poly(rp);
5.
>>a=[1,3,5,-2];
>>polyval(f,a)
>>polyval(g,a)
>>polyval(h,a)
>>polyval(p,a)
c. Answer:
1.
a=
1 -7 1 -12 -5
b=
1 -9 -1 -6 -7
product =
Columns 1 through 8
0 1 -7 -11 16 -23 21 9
Column 9
-6
quotient =
1 -9
a=
3 -6 -34 0 9
b=
3 -10 -40 4 -1
product =
Columns 1 through 8
Column 9
20
quotient =
1.5000 -6.2500
2.
f1 =
0 5 5 -15 5
h1 =
18 -48 -222 12 24
p1 =
0 14 21 -14 35
3.
ans =
8.1467
0.1904 + 1.1661i
0.1904 - 1.1661i
-0.5276
ans =
-2.4142
1.0000
0.4142
ans =
5.0653
-2.4296
0.3450
-0.3140
ans =
-2.3681
0.4340 + 0.9313i
0.4340 - 0.9313i
4.
poly1 =
5.
ans =
0 28 136 3
ans =
-36 -296 -36 -36
ans =
8 80 320 5
2.
a. Problem: Partial – Fraction Expansion with MATLAB
b. MATLAB Codes:
c. Answer:
r=
-3.3333
13.3333
p=
-6
-3
k=
[]
r=
0.8322
0.0798
0.0423 - 0.2635i
0.0423 + 0.2635i
0.0017 - 0.1173i
0.0017 + 0.1173i
p=
-6.5869
-0.9470
-0.2834 + 0.8642i
-0.2834 - 0.8642i
0.5504 + 0.5278i
0.5504 - 0.5278i
k=
[]
r=
1.0486
0.3140 - 0.2522i
0.3140 + 0.2522i
-0.3383 - 0.7823i
-0.3383 + 0.7823i
p=
-2.5797
0.4432 + 1.1784i
0.4432 - 1.1784i
-0.6534 + 0.2494i
-0.6534 - 0.2494i
k=
[]
r=
-2.7849
2.7684
-0.0008 + 0.1278i
-0.0008 - 0.1278i
0.0182
p=
-8.0000
-7.6056
-2.5000 + 0.8660i
-2.5000 - 0.8660i
-0.3944
k=
[]