100% found this document useful (1 vote)
267 views

Lab Report#1 - CS

This lab report summarizes tasks completed in an introduction to MATLAB course. The tasks involved using MATLAB commands to perform operations like finding polynomials, representing transfer functions as polynomials divided by polynomials, and evaluating partial fractions. The report includes the MATLAB code and output for 6 tasks involving topics covered in the course prelabs, such as finding polynomials, representing transfer functions in different forms, and combining transfer functions using addition, subtraction and multiplication.

Uploaded by

Fahad Siddiq
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
100% found this document useful (1 vote)
267 views

Lab Report#1 - CS

This lab report summarizes tasks completed in an introduction to MATLAB course. The tasks involved using MATLAB commands to perform operations like finding polynomials, representing transfer functions as polynomials divided by polynomials, and evaluating partial fractions. The report includes the MATLAB code and output for 6 tasks involving topics covered in the course prelabs, such as finding polynomials, representing transfer functions in different forms, and combining transfer functions using addition, subtraction and multiplication.

Uploaded by

Fahad Siddiq
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 6

Lab Report # I

Course: Control Systems


Instructor: Sir. Hussain Asif
Submitted by: Muhammad Fahad Siddiq
ID:150271
Dated:3rd October.2020

Department of Electrical Engineering


Faculty of Engineering
Air University, Islamabad
Lab#01
Introduction to MATLAB
Lab Tasks

Task#1: Use MATLAB to find P3, P4 and P5 in Prelab 1


Code Output
%Task 1
clc
clear all
close all

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);

Task#3: Use only two MATLAB commands to find G1(s) in Prelab


3a represented as a polynomial divided by polynomial.
Code Output
%Task 3a
clc
clear all
close all
a=zpk
([-2 -3 -6 -8 ],
[0 -7 -9 -10 -15
],20)
b=tf(a)

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

You might also like