You are on page 1of 4

Control systems.

Lab report#4.
(Introduction to Matlab and Simulink, Solution of Differential Equations Using
Matlab

and Simulink and Transfer Function Based Modelling )

Group memebers
Muhammad zohaib raza
Rana Imran anwar
Syed arif kazmi

FA13-bet-048
FA13-bet-050
Fa13-bet-026

Submitted to
Sir Ali Ajwad

Lab Tasks:

Task-1:
Considering G(s),
G=s+0.25/[s(s+1)(s+2)(s+3)]
Prove that tf2zp() and zp2tf() are inverse of each other. Also, prove that laplace()
and illaplace() exhibits the same property.

ZP2TF
>> num=[- 0.25]
num =
- 0.2500
>> den=[-1 -2 -3 0]
den =
-1 -2 -3
0
>> g=zpk([-0.25],[0 -1 -2 -3],[1])
Zero/pole/gain:
(s+0.25)
------------------s (s+1) (s+2) (s+3)
>> [num den]=zp2tf([-0.25],[0 -1 -2 -3],[1])
num =
0
0
0 1.0000 0.2500
den =
1
6 11
6
0

TF2ZP
>> num=[1 0.25]
num =
1.0000 0.2500
>> den=[1 6 11 6 0]
den =
1
6 11
6
0
>> g=tf(num,den)
Transfer function:
s + 0.25
-------------------------s^4 + 6 s^3 + 11 s^2 + 6 s
>> [z p k]=tf2zp(num,den)
z=
-0.2500
p=
0
-3.0000
-2.0000
-1.0000

k=
1

Laplace and Ilaplace


>> syms s
>> g=(s+0.25)/(s^4+6*s^3+11*s^2+6*s)
g=
(s + 1/4)/(s^4 + 6*s^3 + 11*s^2 + 6*s)
>> ilaplace(g)
ans =
3/(8*exp(t)) - 7/(8*exp(2*t)) + 11/(24*exp(3*t)) + 1/24
>> laplace(ans)
ans =
3/(8*(s + 1)) - 7/(8*(s + 2)) + 11/(24*(s + 3)) + 1/(24*s)
Task- 2:
Find inverse laplace transform f(t) & hence find inverse from partial fraction form (use MATLAB to compute the
residues). Where

F( s)=

s5 +8 s 4+ 23 s 3+ 35 s2 +28 s+3
s 3 +6 s 2 +8 s

Solve the differential equation to compute x(t)


X + 2X + 10X = t2

Ilaplace
>> syms s
>> g=(s^5+8*s^4+23*s^3+35*s^2+28*s+3)/(s^3+6*s^2+8*s)
g=
(s^5 + 8*s^4 + 23*s^3 + 35*s^2 + 28*s + 3)/(s^3 + 6*s^2 + 8*s)
>> ilaplace(g)
ans =
1/(4*exp(2*t)) + 3/(8*exp(4*t)) + 3*dirac(t) + 2*dirac(t, 1) + dirac(t, 2) + 3/8

Inverse from Partial Fraction


>> num=[1 8 23 35 28 3]
num =
1
8 23 35 28
3
>> den=[0 0 1 6 8 0]
den =
0
0
1
6
8
0
>> [r,p,k]=residue(num,den)
r=
0.3750
0.2500
0.3750
p=

-4
-2
0
k=
1

Lab Task No 3:

Consider the following RLC circuit (Fig 4.3) and take values of your
choice. Make a mathematical equation of this circuit (taking your own
defined values) and then make its Simulink block diagram.

Simulink model.

Result.

You might also like