Lab Report#1 - CS
Lab Report#1 - CS
p1=[1 7 2 9 10 12 15];
p2=[1 9 8 9 12 15 20];
x=roots(p1);
y=roots(p2);
p3=p1+p2;
p4=p1-p2;
p5=p1.*p2;
2|Page
Task#2: Use only one MATLAB command to find P6 in Prelab 2
Code Output
clc
clear all
close all
x=[-3 -5 -7 -8 -9 -10];
y=poly(x);
3|Page
Task#4: Use only two MATLAB commands to find G2(s).
Code Output
%Task 4
clc
clear all
close all
num=[1 17 99 223
140];
den=[1 32 363 2092
5052 4320];
sys = tf(num,den)
[r p
k]=residue(num,den)
par_frac = zpk(sys)
4|Page
Task#5: Use various combinations of G1(s) and G2(s) to find G3(s),
G4(s) and G5(s)
Code Output
%Task 5
g1_s = zpk([-2
-3 -6 -8],[0 -7
-9 -10 -15],20)
par_frac1 =
zpk(g1_s)
num = [1 17 99
223 140]
den = [1 32 363
2092 5052 4320]
g2_s =
tf(num,den)
par_frac2 =
zpk(g2_s)
g3_s=
par_frac1 +
par_frac2
g4_s=
par_frac1 -
par_frac2
g5_s=
par_frac1.*
par_frac2
5|Page
Task#6: Use MATLAB to evaluate partial fraction in Pre lab 4.
Code Output
% Task 6
clc
clear all
close all
den1 = [1 8 15];
num1 = [5 10];
[r1,p1,k1]=
residue(den1,num1)
den2 = [1 6 9];
num2 = [5 10];
[r2,p2,k2] =
residue(den2,num2)
den3 = [1 6 34];
num3 = [5 10];
[r3,p3,k3] =
residue(den3,num3)
________________________
6|Page