You are on page 1of 19

Experiment 2.

1:
Ques (1) Given that : P1=s6+7s5+2s4+9s3+10s2+12s+15;
P2=s6+9s5+8s4+9s3+12s2+15s+20
Use Matlab to find:
P3=P1+P2, P4=P1- P2 P5=P1* P2
Solution:
MATLAB Scripts:
>> P1=[1 7 2 9 10 12 15]; % vector with coefficients of polynomial P1
>> P2=[1 9 8 9 12 15 20]; % vector with coefficients of polynomial P2
>> P3=P1+P2 % find P3 ( the sum of P1 and P2)
P3 =
2 16 10 18 22 27 35
>> P4=P1-P2 % calculate the value of P4
P4 =
0 -2 -6 0 -2 -3 -5
>> P5=conv(P1,P2) % P5 is the product of the polynomials P1 and P2
P5 =
1 16 73 92 182 291 433 599 523 609 560 465 300

Results:
Therefore,
P3=2s6+16s5+10s4+18s3+22s2+27s+35
P4=-2s5-6s4-2s2-3s-5
P5=s12+16s11+73s10+92s9+182s8+291s7+433s6+599s5+523s4+609s3+560s2+465s+300

Ques (2)
P6=(s+7)(s+8)(s+3)(s+5)(s+9)(s+10)
Roots of P6 are: s=-7,-8,-3,-5,-9 & -10

Matlab script
>> r=[-7,-8,-3,-5,-9,-10] ; % root vector of P6
>> P6=poly(r) % computes the coefficient of the polynomial from the roots
P6 =
Columns 1 through 6
1
42
718
6372
30817
76530
Column 7
75600

Result:
P6=s6+42s5+718s4+6372s3+30817s2+ 76530s+75600
Ques (3):
Use two Matlab commands to find the transfer function G1(s) given below as a
polynomial divide by a polynomial:

Solution:
Matlab Script
>> s=tf('s');
% Define s as a Linear Time Invariant (LTI) object in polynomial form
>> G=20*(s+2)*(s+3)*(s+6)*(s+8)/(s*(s+7)*(s+9)*(s+10)*(s+15)); % Form G(s) as a LTI transfer function in
polynomial form
>> G
Transfer function:
20 s^4 + 380 s^3 + 2480 s^2 + 6480 s + 5760
------------------------------------------s^5 + 41 s^4 + 613 s^3 + 3975 s^2 + 9450 s

Ques (4)
Use two Matlab commands to find the transfer function G2(s) expressed as factor in
numerator divide by factor in the denominator:

Solution:
Matlab script
>> s=zpk('s'); % Define s as LTI object in factored form
>> G2=(s^4+17*s^3+99*s^2+223*s+140)/(s^5+32*s^4+363*s^3+2092*s^2+5052*s+4320)
Warning: Accuracy may be poor in parts of the frequency range.
Use the "prescale" command to maximize accuracy in the range of interest.
> In warning at 26
In xscale at 135
In @zpkdata\private\utSS2ZPK at 12
In zpkdata.plus>LocalAddSISO at 41
In zpkdata.plus at 17
In lti.plus at 55
Zero/pole/gain:
(s+1) (s+4) (s+5) (s+7)
-----------------------------------------------------(s+16.79) (s^2 + 4.097s + 4.468) (s^2 + 11.12s + 57.6)

Ques (5)
Using various combinations of G1(s) and G2(s), find:
i)

G3(s)

ii)

G4(s)

iii)

G5(s).

Solution:
i)

G3(s) = G1(s) + G2(s)

Matlab script:
a) Various combinations for calculation of G3(s):
>> % Calculation of G3 with G1 expressed in factor form and G2 expressed in factor form.
>> s=zpk('s');
>> G1=20*(s+2)*(s+3)*(s+6)*(s+8)/(s*(s+7)*(s+9)*(s+10)*(s+15));
>> G2=(s^4+17*s^3+99*s^2+223*s+140)/(s^5+32*s^4+363*s^3+2092*s^2+5052*s+4320);
Warning: Accuracy may be poor in parts of the frequency range.

Use the "prescale" command to maximize accuracy in the range of interest.


> In warning at 26
In xscale at 135
In @zpkdata\private\utSS2ZPK at 12
In zpkdata.plus>LocalAddSISO at 41
In zpkdata.plus at 17
In lti.plus at 55
>> G3=G1+G2
Zero/pole/gain:
21 (s+16.76) (s+7.999) (s+6.003) (s^2 + 6.079s + 9.499) (s^2 + 3.033s + 2.607) (s^2 + 11.46s + 59.47)
----------------------------------------------------------------------------------------------------s (s+7) (s+9) (s+10) (s+15) (s+16.79) (s^2 + 4.097s + 4.468) (s^2 + 11.12s + 57.6)

>> % Calculation of G3 with G1 expressed in polynomial form and G2 expressed in factor form
>> G1=20*(s+2)*(s+3)*(s+6)*(s+8)/(s*(s+7)*(s+9)*(s+10)*(s+15)); % Inputs G1
>> G1zpk=G1; % stores G1 in G1zpk
>> G1tf=tf(G1zpk); %converts G1 to polynomial form
>> G2=(s^4+17*s^3+99*s^2+223*s+140)/(s^5+32*s^4+363*s^3+2092*s^2+5052*s+4320); %input G2
>> G2tf=G2; % G2 stored in polynomial form
>> G2zpk=zpk(G2tf); %converts G2 to factor form
>> G3=G1+G2
Transfer function:
21 s^9 + 1078 s^8 + 23309 s^7 + 284298 s^6 + 2.156e006 s^5 + 1.043e007 s^4 + 3.173e007 s^3
+ 5.816e007 s^2 + 5.842e007 s + 2.488e007
--------------------------------------------------------------------------------------------------s^10 + 73 s^9 + 2288 s^8 + 40566 s^7 + 449993 s^6 + 3.239e006 s^5 + 1.502e007 s^4 + 4.25e007 s^3
+ 6.491e007 s^2 + 4.082e007 s
>> % Calculation of G3 with both G1 and G2 expressed in polynomial form
>> s=tf('s');
>> G1=20*(s+2)*(s+3)*(s+6)*(s+8)/(s*(s+7)*(s+9)*(s+10)*(s+15));
>> G2=(s^4+17*s^3+99*s^2+223*s+140)/(s^5+32*s^4+363*s^3+2092*s^2+5052*s+4320);
>> G3=G1+G2
Transfer function:
21 s^9 + 1078 s^8 + 23309 s^7 + 284298 s^6 + 2.156e006 s^5 + 1.043e007 s^4 + 3.173e007 s^3
+ 5.816e007 s^2 + 5.842e007 s + 2.488e007
---------------------------------------------------------------------------------------------------

s^10 + 73 s^9 + 2288 s^8 + 40566 s^7 + 449993 s^6 + 3.239e006 s^5 + 1.502e007 s^4 + 4.25e007 s^3
+ 6.491e007 s^2 + 4.082e007 s

>> % Calculation of G3 with G1 expressed in factor form and G2 expressed in polynomial form.
>> s=zpk('s');
>> G1=20*(s+2)*(s+3)*(s+6)*(s+8)/(s*(s+7)*(s+9)*(s+10)*(s+15));
>> s=tf('s');
>> G2=(s^4+17*s^3+99*s^2+223*s+140)/(s^5+32*s^4+363*s^3+2092*s^2+5052*s+4320);
>> G3=G1+G2
Zero/pole/gain:
21 (s+16.76) (s+7.999) (s+6.003) (s^2 + 6.079s + 9.499) (s^2 + 3.033s + 2.607) (s^2 + 11.46s + 59.47)
----------------------------------------------------------------------------------------------------s (s+7) (s+9) (s+10) (s+15) (s+16.79) (s^2 + 4.097s + 4.468) (s^2 + 11.12s + 57.6)

b) Various combinations for calculation of G4(s):


Matlab Script:
>> % Calculation of G4 with both G1 and G2 expressed in factor form
>> s=zpk('s');
>> G1=20*(s+2)*(s+3)*(s+6)*(s+8)/(s*(s+7)*(s+9)*(s+10)*(s+15));
>> G2=(s^4+17*s^3+99*s^2+223*s+140)/(s^5+32*s^4+363*s^3+2092*s^2+5052*s+4320);
Warning: Accuracy may be poor in parts of the frequency range.
Use the "prescale" command to maximize accuracy in the range of interest.
> In warning at 26
In xscale at 135
In @zpkdata\private\utSS2ZPK at 12
In zpkdata.plus>LocalAddSISO at 41
In zpkdata.plus at 17
In lti.plus at 55
>> G4=G1-G2
Zero/pole/gain:
19 (s+16.81) (s+8.001) (s+5.997) (s+3.252) (s+1.496) (s^2 + 4.335s + 6.018) (s^2 + 10.74s + 55.47)
-------------------------------------------------------------------------------------------------s (s+7) (s+9) (s+10) (s+15) (s+16.79) (s^2 + 4.097s + 4.468) (s^2 + 11.12s + 57.6)
>> % Calculation of G4 with both G1 and G2 expressed in polynomial form
>> s=tf('s');
>> G1=20*(s+2)*(s+3)*(s+6)*(s+8)/(s*(s+7)*(s+9)*(s+10)*(s+15));
>> G2=(s^4+17*s^3+99*s^2+223*s+140)/(s^5+32*s^4+363*s^3+2092*s^2+5052*s+4320);
>> G4=G1-G2

Transfer function:
19 s^9 + 962 s^8 + 20491 s^7 + 246942 s^6 + 1.862e006 s^5 + 9.034e006 s^4 + 2.791e007 s^3
+ 5.284e007 s^2 + 5.577e007 s + 2.488e007
---------------------------------------------------------------------------------------------------s^10 + 73 s^9 + 2288 s^8 + 40566 s^7 + 449993 s^6 + 3.239e006 s^5 + 1.502e007 s^4 + 4.25e007 s^3
+ 6.491e007 s^2 + 4.082e007 s

>> % Calculation of G3 with G1 expressed in factor form and G2 expressed in polynomial form.
>> s=zpk('s');
>> G1=20*(s+2)*(s+3)*(s+6)*(s+8)/(s*(s+7)*(s+9)*(s+10)*(s+15));
>> s=tf('s');
>> G2=(s^4+17*s^3+99*s^2+223*s+140)/(s^5+32*s^4+363*s^3+2092*s^2+5052*s+4320);
>> G4=G1-G2
Zero/pole/gain:
19 (s+16.81) (s+8.001) (s+5.997) (s+3.252) (s+1.496) (s^2 + 4.335s + 6.018) (s^2 + 10.74s + 55.47)
-------------------------------------------------------------------------------------------------s (s+7) (s+9) (s+10) (s+15) (s+16.79) (s^2 + 4.097s + 4.468) (s^2 + 11.12s + 57.6)

>> % Calculation of G4 with G1 expressed in polynomial form and G2 expressed in factor form
>> G1=20*(s+2)*(s+3)*(s+6)*(s+8)/(s*(s+7)*(s+9)*(s+10)*(s+15)); % Inputs G1
>> G1zpk=G1; % stores G1 in G1zpk
>> G1tf=tf(G1zpk); %converts G1 to polynomial form
>> G2=(s^4+17*s^3+99*s^2+223*s+140)/(s^5+32*s^4+363*s^3+2092*s^2+5052*s+4320); %input G2
>> G2tf=G2; % G2 stored in polynomial form
>> G2zpk=zpk(G2tf); %converts G2 to factor form
>> G4=G1-G2
Transfer function:
19 s^9 + 962 s^8 + 20491 s^7 + 246942 s^6 + 1.862e006 s^5 + 9.034e006 s^4 + 2.791e007 s^3
+ 5.284e007 s^2 + 5.577e007 s + 2.488e007
--------------------------------------------------------------------------------------------------s^10 + 73 s^9 + 2288 s^8 + 40566 s^7 + 449993 s^6 + 3.239e006 s^5 + 1.502e007 s^4 + 4.25e007 s^3
+ 6.491e007 s^2 + 4.082e007 s

c) Various combinations for calculation of G5(s):


Matlab script:

>> % Calculation of G5 with both G1 and G2 expressed in factor form


>> G1=20*(s+2)*(s+3)*(s+6)*(s+8)/(s*(s+7)*(s+9)*(s+10)*(s+15));
>> G2=(s^4+17*s^3+99*s^2+223*s+140)/(s^5+32*s^4+363*s^3+2092*s^2+5052*s+4320); %input G2
>> G2tf=G2; % G2 stored in polynomial form
>> G2zpk=zpk(G2tf); %converts G2 to factor form
>> G5=G1*G2zpk % calculates G5 with G1 and G2 expressed in factor form
Zero/pole/gain:
20 (s+8) (s+7) (s+6) (s+5) (s+4) (s+3) (s+2) (s+1)
---------------------------------------------------------------------------------s (s+15) (s+16.79) (s+10) (s+9) (s+7) (s^2 + 4.097s + 4.468) (s^2 + 11.12s + 57.6)

>> % Calculation of G5 with both G1 and G2 expressed in polynomial form


>> G1=20*(s+2)*(s+3)*(s+6)*(s+8)/(s*(s+7)*(s+9)*(s+10)*(s+15)); % Inputs G1
>> G1zpk=G1; % stores G1 in G1zpk
>> G1tf=tf(G1zpk); %converts G1 to polynomial form
>> G2=(s^4+17*s^3+99*s^2+223*s+140)/(s^5+32*s^4+363*s^3+2092*s^2+5052*s+4320); %input G2
>> G5=G1tf*G2 % calculates G5 with G1 and G2 expressed in polynomial form
Transfer function:
20 s^8 + 720 s^7 + 10920 s^6 + 90720 s^5 + 448980 s^4 + 1.346e006 s^3 + 2.362e006 s^2 + 2.192e006 s
+ 806400
---------------------------------------------------------------------------------------------------s^10 + 73 s^9 + 2288 s^8 + 40566 s^7 + 449993 s^6 + 3.239e006 s^5 + 1.502e007 s^4 + 4.25e007 s^3
+ 6.491e007 s^2 + 4.082e007 s
>> % Calculation of G5 with G1 expressed in factor form and G2 expressed in polynomial form
>> G1=20*(s+2)*(s+3)*(s+6)*(s+8)/(s*(s+7)*(s+9)*(s+10)*(s+15)); % Inputs G1
>> G2=(s^4+17*s^3+99*s^2+223*s+140)/(s^5+32*s^4+363*s^3+2092*s^2+5052*s+4320); %input G2
>> G5=G1*G2 % calculates G5 with G1 expressed in factor form and G2 expressed in polynomial form
Transfer function:
20 s^8 + 720 s^7 + 10920 s^6 + 90720 s^5 + 448980 s^4 + 1.346e006 s^3 + 2.362e006 s^2 + 2.192e006 s
+ 806400
---------------------------------------------------------------------------------------------------s^10 + 73 s^9 + 2288 s^8 + 40566 s^7 + 449993 s^6 + 3.239e006 s^5 + 1.502e007 s^4 + 4.25e007 s^3
+ 6.491e007 s^2 + 4.082e007 s

>> % Calculation of G5 with G1 expressed in polynomial form and G2 expressed in factor form
>> G1=20*(s+2)*(s+3)*(s+6)*(s+8)/(s*(s+7)*(s+9)*(s+10)*(s+15)); % Inputs G1

>> G1zpk=G1; % stores G1 in G1zpk


>> G1tf=tf(G1zpk); %converts G1 to polynomial form
>> G2=(s^4+17*s^3+99*s^2+223*s+140)/(s^5+32*s^4+363*s^3+2092*s^2+5052*s+4320); %input G2
>> G2tf=G2; % G2 stored in polynomial form
>> G2zpk=zpk(G2tf); %converts G2 to factor form
>> G5=G1tf*G2zpk % calculates G5 with G1 expressed in polynomial form and G2 expressed in factor form
Transfer function:
20 s^8 + 720 s^7 + 10920 s^6 + 90720 s^5 + 448980 s^4 + 1.346e006 s^3 + 2.362e006 s^2 + 2.192e006 s
+ 806400
---------------------------------------------------------------------------------------------------s^10 + 73 s^9 + 2288 s^8 + 40566 s^7 + 449993 s^6 + 3.239e006 s^5 + 1.502e007 s^4 + 4.25e007 s^3
+ 6.491e007 s^2 + 4.082e007 s

Ques (4)
Use Matlab to evaluate the partial fraction expansions below:

Matlab Script
(a)
>> % Evaluate the partial fraction expansion of G6
>> b=[5,10]; % b is the coefficient of the polynomial in the numerator
>> a=[1,8,15,0]; %a is the coefficient of the polynomial in the denominator
>> [r,p,k]=residue(b,a)
r=
-1.5000
0.8333

0.6667

p=
-5
-3
0

k=
[]

Result: G6= -1.5/(s+5) + 0.833/(s+3) + 0.6667/s


(b)
>> % Evaluate the partial fraction expansion of G7
>> b=[5,10]; % b is the coefficient of the polynomial in the numerator
>> a=[1,6,9,0]; %a is the coefficient of the polynomial in the denominator
>> [r,p,k]=residue(b,a)
r=
-1.1111
1.6667
1.1111
p=
-3
-3
0
k=
[]

Result: G7= -1.1/(s+3) + 1.7/(s+3)2 + 1.1/s

c)
>> % Evaluate the partial fraction expansion of G8
>> b=[5,10]; % b is the coefficient of the polynomial in the numerator
>> a=[1,6,34,0]; %a is the coefficient of the polynomial in the denominator

>> [r,p,k]=residue(b,a)
r=
-0.1471 - 0.4118i
-0.1471 + 0.4118i
0.2941
p=
-3.0000 + 5.0000i
-3.0000 - 5.0000i
0
k=
[]

Result: G8= ( -0.1471-j0.4118)/(s+3-j5) + (-0.1471+j0.4118)/(s+3+j5) + 0.2941/s

Experiment 2.2 (LAB):


Ques (1a) Use MATLAB and the Symbolic Math Toolbox to generate symbolically the
time function f(t) given as:

Matlab script:
>> %Generate a symbolically the time function f(t)
>> f=0.0075-0.00034*exp(-2.5*t)*cos(22*t)+0.087*exp(-2.5*t)*sin(22*t)-0.0072*exp(-8*t);
>> %Generate a symbolically the time function f(t)
>> syms t; % define symbolic variable
>> ft=0.0075-0.00034*exp(-2.5*t)*cos(22*t)+0.087*exp(-2.5*t)*sin(22*t)-0.0072*exp(-8*t);
>> ft
f t=
(87*sin(22*t))/(1000*exp((5*t)/2)) - (17*cos(22*t))/(50000*exp((5*t)/2)) - 9/(1250*exp(8*t)) + 3/400

1b) Generate symbolically F(s) below and obtain result symbolically in both factored and
polynomial forms.

MATLAB Script
>> %Generate symbolically the function F(s)
>> syms s % Define symbolic variable
>> F=2*(s+3)*(s+5)*(s+7)/(s*(s+8)*(s^2+10*s+100));
>> F
F=
((2*s + 6)*(s + 5)*(s + 7))/(s*(s + 8)*(s^2 + 10*s + 100))
>> % Obtain F in factored form
>> s=zpk('s');
>> Fzpk=2*(s+3)*(s+5)*(s+7)/(s*(s+8)*(s^2+10*s+100)); % Fzpk is the factored form of F
>> Fzpk
Zero/pole/gain:
2 (s+3) (s+5) (s+7)
------------------------s (s+8) (s^2 + 10s + 100)
>> % Obtain F in polynomial form
>> s=tf('s');
>> Ftf=2*(s+3)*(s+5)*(s+7)/(s*(s+8)*(s^2+10*s+100)); % Ftf is the polynomial form of F
>> Ftf
Transfer function:
2 s^3 + 30 s^2 + 142 s + 210
-----------------------------s^4 + 18 s^3 + 180 s^2 + 800 s

1c) Find the Laplace transform of f(t) in (1a)


MATLAB script

>> % Calculate the Laplace transform of ft


>> syms t s
>> ft=0.0075-0.00034*exp(-2.5*t)*cos(22*t)+0.087*exp(-2.5*t)*sin(22*t)-0.0072*exp(-8*t);
>> laplace(ft,t,s) %computes the laplace transmform of ft
ans =
3/(400*s) - 9/(1250*(s + 8)) - (17*(s + 5/2))/(50000*((s + 5/2)^2 + 484)) + 957/(500*((s + 5/2)^2 + 484))

1d) Find the inverse Laplace transform of F(s) in (1b)


MATLAB Script
>> % Calculate the inverse Laplace transform of F(s)
>> syms t s % Define symbolic variable
>> FS=2*(s+3)*(s+5)*(s+7)/(s*(s+8)*(s^2+10*s+100));
>> IFS=ilaplace(FS,s,t) %Computes the inverse laplace transform of FS
Result:
IFS =
5/(112*exp(8*t)) + (237*(cos(5*3^(1/2)*t) + (3^(1/2)*sin(5*3^(1/2)*t))/9))/(140*exp(5*t)) + 21/80

1f) Solve for loop currents in diagram below:

MATLAB Script
>> syms s I1 I2 I3 V

>> z=[7+s+(5/s) -(2+s) -5; -(2+s) (4+2*s+3/s) -(2+s); -5 -(2+s) 8+s+4/s];


>> I=[I1; I2; I3];
>> VS=[V; 0; 0];
>> I=inv(z)*VS;
>> pretty(I)
+|

-+
4

| V s (s + 16 s + 39 s + 40 s + 12)

| ----------------------------------------- |
| 5

| s + 26 s + 205 s + 396 s + 284 s + 60 |


|
|
|

|
2 3

V s (s + 15 s + 30 s + 8)

| ----------------------------------------- |
| 5

| s + 26 s + 205 s + 396 s + 284 s + 60 |


|
|
|

|
2 3

V s (s + 14 s + 24 s + 15)

| ----------------------------------------- |
| 5

| s + 26 s + 205 s + 396 s + 284 s + 60 |


Interpretation of Result

)
(

Experiment 2.3
LAB USING MATLAB
2) Generate the polynomial operations stated in P1 and P2 given below:
P1=s6+7s5+2s4+9s3+10s2+12s+15;
P2=s6+9s5+8s4+9s3+12s2+15s+20
MATLAB Script:
>> % Generate the polynomial P1 and P2
>> P1=s^6+7*s^5+2*s^4+9*s^3+10*s^2+12*s+15;
>> s=tf('s');
>> P1=s^6+7*s^5+2*s^4+9*s^3+10*s^2+12*s+15 %P1 in polynomial form
Transfer function:
s^6 + 7 s^5 + 2 s^4 + 9 s^3 + 10 s^2 + 12 s + 15
>> s=tf('s'); %define 's'as an LTI object in polynomial form
>> P2=s^6+9*s^5+8*s^4+9*s^3+12*s^2+15*s+20 %P2 defined in polynomial form
Transfer function:
s^6 + 9 s^5 + 8 s^4 + 9 s^3 + 12 s^2 + 15 s + 20

3) Generate the polynomial operations P3=P1+P2, P4=P1-P2, P5=P1*P2


MATLAB Script
Transfer function:
>> % Generate the polynomial P3=P1+P2
>> P1=s^6+7*s^5+2*s^4+9*s^3+10*s^2+12*s+15;
>> P2=s^6+9*s^5+8*s^4+9*s^3+12*s^2+15*s+20;

>> P3=P1+P2
Transfer function:
2 s^6 + 16 s^5 + 10 s^4 + 18 s^3 + 22 s^2 + 27 s + 35
>> % Generate the polynomial P4=P1-P2
>> P1=s^6+7*s^5+2*s^4+9*s^3+10*s^2+12*s+15;
>> P2=s^6+9*s^5+8*s^4+9*s^3+12*s^2+15*s+20;
>> P4=P1-P2
Transfer function:
-2 s^5 - 6 s^4 - 2 s^2 - 3 s - 5
>> % Generate the polynomial P5=P1*P2
>> P1=s^6+7*s^5+2*s^4+9*s^3+10*s^2+12*s+15;
>> P2=s^6+9*s^5+8*s^4+9*s^3+12*s^2+15*s+20;
>> P5=P1*P2
Transfer function:
s^12 + 16 s^11 + 73 s^10 + 92 s^9 + 182 s^8 + 291 s^7 + 433 s^6 + 599 s^5 + 523 s^4 + 609 s^3
+ 560 s^2 + 465 s + 300

4) Generate the polynomial whose roots are: -7, -8, -3, -5, -9, 10
MATLAB Script
>> %Generate a polynomial from given roots
>> r=[-7 -8 -3 -5 -9 -10]; %roots of a polynomial
>> p=poly(r) % Find the coefficient of the polynomial whose roots are given
p=
1

42

718

6372

30817

76530

75600

Result:

5) Generate the partial fraction expansion of the transfer function G(s)


MATLAB Script

>> %Perform the partial fraction expansion of G(s)


>> num=[5,10]; % Coefficient of numerator's polynomial
>> den=[1,8,15,0]; %Coefficient of denomerator's polynomial
>> [r,p,k]=residue(num,den)
r=
-1.5000
0.8333
0.6667
p=
-5
-3
0

k=
[]

Result:
( )

6. Construct the two transfer functions enumerated in question (5)


MATLAB Script
>> G1=tf([1],[1 1 2])
G1 =
1
----------s^2 + s + 2
Continuous-time transfer function.
>> G2=tf([1 1],[1 4 3])
G2 =
s+1
------------s^2 + 4 s + 3
Continuous-time transfer function.
>> F=G1+G2
F=
s^3 + 3 s^2 + 7 s + 5
-----------------------------s^4 + 5 s^3 + 9 s^2 + 11 s + 6

Continuous-time transfer function.


>> P=G1-G2
P=
-s^3 - s^2 + s + 1
-----------------------------s^4 + 5 s^3 + 9 s^2 + 11 s + 6
Continuous-time transfer function.
>> T=G1*G2
T=
s+1
-----------------------------s^4 + 5 s^3 + 9 s^2 + 11 s + 6
Continuous-time transfer function.

7.

For G1(s) + G2(s)

MATLAB Script
>>num=[1 3 7 5];
>> den=[1 5 9 11 6];
>> [r,p,k]=residue(num,den)
r=
1.0000
0.0000 - 0.3780i
0.0000 + 0.3780i
-0.0000
p=
-3.0000
-0.5000 + 1.3229i
-0.5000 - 1.3229i
-1.0000
k=
[]

Result
( )
G1(s) G2(s)
MATLAB Script
>>num=[-1 -1 1 1];

( )

>> den=[1 5 9 11 6];


>> [r,p,k]=residue(num,den)
r=
-1.0000
-0.0000 - 0.3780i
-0.0000 + 0.3780i
0
p=
-3.0000
-0.5000 + 1.3229i
-0.5000 - 1.3229i
-1.0000
k=
[]

INTERPRETATION
( )

( )

G1(s)G2(s)

MATLAB Script
num=[1 1];
>> den=[1 5 9 11 6];
>> [r,p,k]=residue(num,den)
r=
0.1250
-0.0625 - 0.1181i
-0.0625 + 0.1181i
-0.0000
p=
-3.0000
-0.5000 + 1.3229i
-0.5000 - 1.3229i
-1.0000
k=
[]

INTERPRETATION
( )

( )

You might also like