Lab No. 3-Block Diagram Reduction

Download as pdf or txt
Download as pdf or txt
You are on page 1of 12

Lab No.

03
Section: A Block Diagram Reduction
General Description:
Block diagram consist of Uni-directional operational block that represent the transfer function of
the variable of the interest. The block diagram of representation of a given system often can be
reduced to a simplified block diagram with fewer blocks than original block.
Useful Commands for block-reduction:

i) conv
Convolution and polynomial multiplication:
Syntax:
w = conv(u,v)

ii) Tf
Create or convert to transfer function model.

sys = tf(num,den)
sys = tf(num,den,Ts)
sys = tf(M)
sys = tf(num,den,ltisys)
tfsys = tf(sys)

iii) Feedback
Syntax:
sys = feedback(sys1,sys2)

Problem # 01:
Find the Close-loop gain of a given system in Matlab using feedback.
Source Code:
%Block diagram reduction
num=conv([1 1],[1]); %convolving the cascaded System neuminator
den=conv([1 2],[200 0 0]); %convolving the denominator system denominator
G=tf(num,den) %calculating the tf of a system
H=1;.
T=feedback(G,H) %using feed-back command to find cloase loop tf

Output:

G=

s+1
-----------------
200 s^3 + 400 s^2

Continuous-time transfer function

T=

s+1
-------------------------
200 s^3 + 400 s^2 + s + 1

Continuous-time transfer function.

Problem# 02:
Find the Close loop Transfer function of a given system using Matlab.
Source Code:
%Problem # 02 %find the close loop transfer function of a system.
num1=[1]; %declaring the numerator of feed-forward path.
den1=[200 0 0]; %declaring the denominator of feed-forward path.
num2=[1 1]; %declaring the numerator of feed-back path.
den2=[1 2]; %declaring the denominator of feed-back path.
G=tf(num1,den1) %finding tf of feed-forward path
H=tf(num2,den2) %finding tf of feed-back path
T=feedback(G,H,1) %finding tf of close-loop system: Put 1 for +ve
%Feedback at end of feedback(G,H)

Output:

G=

1
-------
200 s^2

Continuous-time transfer function.

H=

s+1
-----
s+2

Continuous-time transfer function.

T=

s+2
-------------------------
200 s^3 + 400 s^2 - s - 1

Continuous-time transfer function.


Section: B State Space Representation
General Description:
In control engineering, a state-space representation is a mathematical model of a physical
system as a set of input, output and state variables related by first-order differential equations.
"State space" refers to the space whose axes are the state variables. The state of the system can
be represented as a vector within that space.
Useful Commands: ss
ss is used to create real- or complex-valued, state-space models (SS objects) or to convert
transfer function or zero-pole-gain models to state space.
Specify state-space models or convert LTI model to state space
Syntax
ss
sys = ss(a,b,c,d)
sys = ss(a,b,c,d,Ts)
sys = ss(d)
sys = ss(a,b,c,d,ltisys)
sys_ss = ss(sys)

Creation of State-Space Models


sys = ss(a,b,c,d) creates a SS object representing the continuous-time state-space model
For a model with Nx states, Ny outputs, and Nu inputs:
a is an Nx-by-Nx real- or complex-valued matrix.
b is an Nx-by-Nu real- or complex-valued matrix.
c is an Ny-by-Nx real- or complex-valued matrix.
d is an Ny-by-Nu real- or complex-valued matrix.
To set D = 0 , set d to the scalar 0 (zero), regardless of the dimension.
sys = ss(a,b,c,d,Ts) creates the discrete-time model with sample time Ts (in seconds). Set Ts = -1
or Ts = [] to leave the sample time unspecified.

sys = ss(d) specifies a static gain matrix D and is equivalent to


sys = ss([],[],[],d)
sys = ss(a,b,c,d,ltisys) creates a state-space model with generic LTI properties inherited from the
LTI model ltisys (including the sample time).
Matlab Practice

The state-space representation consists of specifying the A, B, C, and D matrices followed by the creation
of an LTI state-space object using the MATLAB command, ss(A,B,C,D).

Problem # 01:

Let;

0 1 0 0
A=[ 0 0 1 ]; B=[0] ; C=[1 1 0]; D=0;
−4 − 5 − 8 4

As 𝑋̇ = 𝐴𝑋 + 𝐵𝑈

Y=CX+DU

Matlab Source Code for the Problem:

‘State_Space_Model’

A=[0 1 0;0 0 1;-4 -5 -8];


B=[0;0;4];
C=[1 1 0];
D=[0];
State_Space_Model =ss(A,B,C,D)
Transfer_Function=tf(State_Space_Model)

Matlab Output:
Problem # 02:

For illustration of state space representation, consider the following simple model of an electric
motor.
Where θ is the angular displacement of the rotor and I is the driving current. The relation
between the input current u = I and the angular velocity y is described by the state-space
equations.

This model is specified by typing

to which MATLAB responds


Problem # 03:

Given the control system;

i) Determine the state variable representation of Controller.


ii) Repeat above for Plant
iii) Use series and feedback systems to find impulse response.
Source Code:
%Problem # 03:SS_for_Cascaded_Feedback_System
% determine state space representation of controller
numC=[1];
denC=[1 2];
sys_C=tf(numC,denC)
sys_ss_C=ss(sys_C)
% plant state-space moodel
nump=[1];
denp=[1 2 4];
sys_P=tf(nump,denp)
sys_ss_P=ss(sys_P)
% use series
[num_Series,den_Series]=series(numC,denC,nump,denp)
% use feedback
num_feedback=[1]
den_feedback=[1]
[num_Closed_Loop_tf,den_Closed_Loop_tf]=feedback(num_Series,den_Series,num_fe
edback,den_feedback,-1)
Closed_Loop_tf=tf(num_Closed_Loop_tf,den_Closed_Loop_tf)
ss_of_Closed_Loop_tf=ss(Closed_Loop_tf)
%Impulse response:
impulse(Closed_Loop_tf)
Impulse response:

Fig 3.1: Impulse Response of the System

Output:

>> Problem # 03_SS_for_Cascaded_Feedback_System

sys_C =

-----

s + 2

Continuous-time transfer function.

sys_ss_C =

a =

x1

x1 -2
b =

u1

x1 1

c =

x1

y1 1

d =

u1

y1 0

Continuous-time state-space model.

sys_P =

-------------

s^2 + 2 s + 4

Continuous-time transfer function.

sys_ss_P =

a =

x1 x2

x1 -2 -2

x2 2 0

b =
u1

x1 0.5

x2 0

c =

x1 x2

y1 0 1

d =

u1

y1 0

Continuous-time state-space model.

num_Series =

0 0 0 1

den_Series =

1 4 8 8

num_feedback =

den_feedback =

num_Closed_Loop_tf =

0 0 0 1

den_Closed_Loop_tf =

1 4 8 9

Closed_Loop_tf =
1

---------------------

s^3 + 4 s^2 + 8 s + 9

Continuous-time transfer function.

ss_of_Closed_Loop_tf =

a =

x1 x2 x3

x1 -4 -2 -2.25

x2 4 0 0

x3 0 1 0

b =

u1

x1 0.5

x2 0

x3 0

c =

x1 x2 x3

y1 0 0 0.5

d =

u1

y1 0

Continuous-time state-space model.

You might also like