0% found this document useful (0 votes)
16 views9 pages

Lab 05 & 06

Uploaded by

laibakhaliq492
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
16 views9 pages

Lab 05 & 06

Uploaded by

laibakhaliq492
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 9

Lab 05

OBJECTIVE
To build models of electrical translation system in terms of transfer function using MATLAB
and SIMULINK.

TRANSFER FUNCTION
The transfer function is defined as the ratio of the Laplace transform of the output C(s) to the
Laplace transform of the input, R(s), of the system. The transfer function is represented by G(s):
C(s)
G ( s )=
R(s)

ELECTRICAL AND MECHANICAL NETWORK TRANSFER FUNCTION


We can model the electric networks, mechanical translational and rotational networks in terms of
transfer function by combining the components of corresponding networks, writing the
differential equations, taking the Laplace transform, deciding the input and output, and then
finding the transfer function (C(s)/R(s)).

MODELING ELECTRICAL SYSTEMS:


Consider the following circuit:

Using Mesh Analysis finding the equation in terms of transfer function:


I 1(S )+ S I 1−S I 2=V (S )
I 2(S )+ 2 S I 2−S I 1−S I 3=0
1
I 3(S )+ S I 3−S I 2− I 3 =0
S
Collecting like terms,
(1+ S)I 1(S )−S I 2 (S )=V (S)
−SI 1 ( S )+ ( 1+2 S ) I 2 ( S )−S I 3 (S)=0
−S I 2( S )+ ¿
(¿ ∆ ¿¿ i(Output ))
Constructing transfer functions using G ( s )=det ¿¿
det ⁡( ∆ ( Input ) )

| |
( 1+ S ) −S V ( S)
−S ( 1+ 2 S ) 0
0 −S 0
I 3 (S )=

| |
( 1+S ) −S 0
−S ( 1+2 S ) −S

0 −S (1+ S+ 1S )
Where the denominator corresponds to ∆
2
Vs
I 3 (S )= 3 2
(3 S +5 S +4 S+ 1)/ S
Rearranging,
I 3 (S) S3
=
V (S ) 3 S 3+ 5 S 2+ 4 S+1
Since, output V c (s) is across capacitor, it is given by:
I (S )
V C (S)= ; ≫ I ( s )=V c ( s)∗C(s)
C(S )
Substituting, C (s )=1 F
V C(S ) S3
G ( s )= =
V (S ) 3 S3 +5 S2 + 4 S +1

Transfer Function of Electrical System


System Parameters
syms s V %defines system variables

delta = [(1+s) -s 0; -s (1+2*s) -s; 0 -s (1+s+1/s)]

%define matrix delta for input variables I1, I2 and I3

delta =

delta_with_input = [(1+s) -s V; -s (1+2*s) 0; 0 -s 0]

%define matrix delta for input V


delta_with_input =

Transfer Function G(s) = Output(s)/Input(s)


I3 = det(delta_with_input)/det(delta) % Use Cramer's rule to solve for I3(s).

I3 =

G=I3/V % Form transfer function, G(s) = I3(s)/V(s).

G =

% For voltage across capacitor

Vc = G*(1/s) % Multiplying gain with unit step input.

Vc =

'Transfer Function' % Display label.

ans = 'Transfer Function'

pretty(Vc) % Making it look properly formatted

2
s
---------------------
3 2
3 s + 5 s + 4 s + 1

Displaying Unit Step Response


num = [1 0 0]; %numerator vector of transfer function

den = [3 5 4 1]; %denominator vector of transfer function

step(num, den) %plot step response of the system


USING SIMULINK:
The given electrical system can also be modelled in Simulink.
To design a Simulink model:
1. Open Simulink and select blocks of transfer function, in and out.
2. Attach the corresponding wires and set them to input and output.
3. Double click on transfer function block and enter the values of numerator and
denominator in form of vector as attached in the screenshot below:

4. To generate step and impulse response of the system go to Linear analysis tool by Select
Analysis > Control Design > Linear Analysis.
5. In the window of Linear analysis tool select your system and generate the step and
impulse response.
The model built in Simulink is:
And, the output obtained using Linear analysis tool is same as we got by coding the system.

INTERPRETATION:
A step response is a straight up change in values, and holds the pattern at the new higher level. A
series of step responses creates a staircase pattern.
On application of step response, the voltage of the capacitor gradually increases indicating
charging of capacitor till 0.128V at time 0.9 seconds but as soon as the capacitor is fully charged
it starts discharging, reaching the negative peak, of voltage -0.0546V at 4.43 seconds, and then
again it charges until its voltage becomes zero and the system stabilizes at time around 14
seconds.
LAB 06

OBJECT: To build models of mechanical translation system in terms of transfer function


using MATLAB and SIMULINK

MODELING MECHANICAL SYSTEMS:


Consider the following mechanical translational system;

Constructing equations of motion,


( M 2 S 2 + F S + K ) X 1 (S)−F S X 2(2)=F I (S)
( M 2 S 2−F S + K ) X 2(S )−F S X 1(S )−KX 3=0
( M 3 S 2 + F S + K ) X 3 (S) −KX3 =0
Collecting Like terms,
( S2 + S+1 ) X 1−SX 2 ( S )=F(S)
−S X 1 ( S) + ( S2 + S+1 ) X 2( S )−X 3 ( S )=0
−X 2( S )+ ( S 2+ S +1 ) X 3 (S )=0
(¿ ∆ ¿¿ i(Output ))
Constructing transfer functions using G ( s )=det ¿¿
det ⁡( ∆ ( Input ) )

| |
( S 2+ S +1 ) −S F (S )
−S ( S 2+ S+ 1 ) 0
0 −1 0
X 3 ( S )=

| |
( S 2 +S +1 ) −S 0
−S ( S + S +1 )
2
−1
0 −1 ( S 2+ S+ 1 )

S F (S)
X 3 ( S )= 3
( S 2+ S +1 ) −S ¿ ¿
Rearranging,
X 3 ( S) S
= 3
¿
F (S ) ( S +S +1 ) + S2 ( S 2 +S +1 ) ¿
2

Transfer Function of Electrical System


System Parameters
syms s F %defines system variables

A = [(s^2+s+1) -s 0; -s (s^2+s+1) -1; 0 -1 (s^2+s+1)] %define matrix A for X1,


X2 and X3.

A =

A3 = [(s^2+s+1) -s F; -s (s^2+s+1) 0; 0 -1 0] %defines matrix A3 for


output X3

A3 =

Transfer Function G(s) = Output(s)/Input(s)


X3 = det(A3)/det(A); % Use Cramer's rule to solve for X3(s).

G = X3/F; % Form transfer function, G(s) = X3(s)/F(s).

'Transfer Function' % Display label.

ans = 'Transfer Function'

pretty(G) % Making it look properly formatted

s
------------------------------------
6 5 4 3 2
s + 3 s + 5 s + 6 s + 4 s + 2 s

Displaying Unit Step Response


num = [1 0]; %numerator vector of transfer function
den = [1 3 5 6 4 2 0]; %denominator vector of transfer function

step(num, den) %plot step response of the system

USING SIMULINK:
The above translational mechanical system can also be modelled by Simulink by just following
the given steps.
INTERPRETATION:
On application of step response, the system shows drastic displacement of 0.733 m in 5.07
seconds and oscillates due to the pull of spring and dashpot from opposite sides. M 3 oscillates for
23 seconds before coming back to its original position at 0.498 m.

You might also like