45
MATLAB Applications No. (3)
Signal Flow Graphs
Objective:
The objective of this application is to obtain the overall transfer function
of a systems using Signal Flow Graphs.
Signal Flow Graphs:
The block diagrams are adequate for the representation of the
interrelationships of controlled and input variables. However, for a
system with reasonably complex interrelationships, the block diagram
reduction procedure is cumbersome and often quite difficult to complete.
A signal-flow graph may be regarded as a simplified version of a block
diagram, which provides the relation between system variables without
requiring any reduction procedure or manipulation of the flow graph.
The signal-flow graph for the cause-and-effect representation of linear
systems that are modeled by algebraic equations. Besides the differences
in the physical appearance of the signal-flow graph and the block
diagram, the signal-flow graph is constrained by more rigid mathematical
rules, whereas the block-diagram notation is more liberal. A signal-flow
graph may be defined as a graphical means of portraying the input-
output relationships among the variables of a set of linear algebraic
equations.
The transfer function the output variable 𝑌(𝑠) to the input variable 𝑅 (𝑠)
of a system represented by a signal flow graph is:
𝑌 (𝑠) ∑ 𝑃𝑘 ∆𝑘
𝑇(𝑠) = =
𝑅 (𝑠) ∆
Khaled Mustafa Mahmoud Session: Spring 2017/2018
46
Where: 𝑃𝑘 the 𝑘𝑡ℎ forward path gain.
∆𝑘 the value of the Δ for that part of the graph not touching the 𝑘𝑡ℎ
forward path.
sum of loop sum of gain productsof all
Δ = 1 − [ gains of all ] + [ possible combination ]
indivisial loops of two non touching loops
sum of gain productsof all sum of gain productsof all
− [ possible combination ] + [ possible combination ] − ⋯
of three non touching loops of four non touching loops
Example 4.1: Determine the closed loop transfer function for the signal
flow graph in Figure 4.1.
Figure 4.1: Signal flow graph for Example 4.1.
Solution:
From the signal flow graph in Figure 4.1, we have:
𝐸 (𝑠) = 𝑅 (𝑠) + 𝐵 (𝑠) (4.1)
𝐵 (𝑠) = −𝐻 (𝑠) 𝑌(𝑠) (4.2)
𝑌 (𝑠) = 𝐺 (𝑠) 𝐸(𝑠) (4.3)
The equations (4.1, 4.2, and 4.3) can be rewritten as:
𝐸 𝐵 𝑌 𝑅
1 −1 0 −1
[ ]
0 1 H 0
−G 0 1 0
Khaled Mustafa Mahmoud Session: Spring 2017/2018
47
>> % To determine the closed loop transfer function of the SFG for Example 4.1%
>> syms G H
>> M=[1 -1 0 -1;1 0 H 0;0 -G 1 0];
>> N=rref(M);
>> T=-N(3,4); % T=Y(s)/R(s) %
>> pretty(T)
G
------------
1+ G H
Example 4.2: A control system has a signal flow graph as shown in Figure
4.2. Find the 𝑌(𝑠)/𝑅(𝑠).
Figure 4.2: Signal flow graph of multiple loop system for Example 4.2.
Solution:
From the signal flow graph in Figure 4.2, we have:
𝐸1 (𝑠) = 𝑅 (𝑠) − 𝐻2 (𝑠) 𝑌 (𝑠)
(4.4)
𝑌 (𝑠) = 𝐺2 (𝑠)𝐸2 (𝑠)
(4.5)
𝐸2 (𝑠) = 𝐺1 (𝑠)𝐸1 (𝑠) − 𝐻1(𝑠) 𝑌(𝑠)
(4.6)
The equations (4.4, 4.5, and 4.6) can be rewritten as:
𝐸1 𝑌 𝐸2 𝑅
1 H2 0 −1
[ ]
0 1 −G2 0
−G1 H1 1 0
Khaled Mustafa Mahmoud Session: Spring 2017/2018
48
>> % To determine the Y(s)/R(s) for the SFG in Example 4.2%
>> syms G1 G2 H1 H2
>> M=[1 H2 0 -1;0 1 -G2 0;-G1 H1 1 0];
>> N=rref(M);
>> T=-N(2,4); % T=Y(s)/R(s) %
>> pretty(T)
G1 G2
------------------------------
1 +G2 H1 + G1 G2 H2
Example 4.3: Consider the interacting system has signal flow graph given
in Figure 4.3. Use MATLAB to determine 𝑌1 (𝑠)/𝑅1(𝑠), 𝑌1 (𝑠)/𝑅2(𝑠) ,
𝑌2 (𝑠)/𝑅1 (𝑠), 𝑌2 (𝑠)/𝑅2 (𝑠).
Figure 4.3: Signal flow graph of interacting system.
Solution:
From the signal flow graph in Figure 4.3, we have:
𝐸1 (𝑠)= 𝑅1 (𝑠)− 𝐻1(𝑠) 𝑌1(𝑠) (4.7)
𝑌1 (𝑠)= 𝐺2(𝑠) 𝐸2 (𝑠) (4.8)
𝐸2 (𝑠)= 𝐺1 (𝑠) 𝐸1(𝑠)+ 𝐺3 (𝑠) 𝐸3 (𝑠) (4.9)
𝐸3 (𝑠)= 𝑅2 (𝑠)− 𝐻2(𝑠) 𝑌2 (𝑠) (4.10)
𝑌2 (𝑠)= 𝐺6 (𝑠) 𝐸4 (𝑠) (4.11)
𝐸4 (𝑠)= 𝐺4 (𝑠) 𝐸2 (𝑠) + 𝐺5 (𝑠) 𝐸3 (𝑠) (4.12)
Khaled Mustafa Mahmoud Session: Spring 2017/2018
49
The equations (4.7 to 4.12) can be rewritten as:
𝐸1 𝑌1 𝐸2 𝐸3 𝑌2 𝐸4 𝑅1 𝑅2
1 H1 0 0 0 0 −1 0
0 1 −G2 0 0 0 0 0
−G2 0 1 −G3 0 0 0 0
0 0 0 1 H2 0 0 −1
0 0 0 0 1 −G6 0 0
[ 0 0 −G4 −G5 0 1 0 0]
>> syms G1 G2 G3 G4 G5 G6 H1 H2
>> M=[1 H1 0 0 0 0 -1 0
0 1 -G2 0 0 0 0 0
-G1 0 1 -G3 0 0 0 0
0 0 0 1 H2 0 0 -1
0 0 0 0 1 -G6 0 0
0 0 -G4 -G5 0 1 0 0];
>> N=rref(M);
>> % To determine the transfer function Y1(s)/R1(s) %
>> T11=-N(2,7);
>> pretty(T11)
G1 G2 + G1 G2 G5 G6 H2
--------------------------------------------------------------------------------
1+ G1 G2 H1 + G5 G6 H2 + G3 G4 G6 H2 + G1 G2 G5 G6 H1 H2
>> % To determine the transfer function Y1(s)/R2(s) %
>> T12=-N(2,8);
>> pretty(T12)
G2 G3
---------------------------------------------------------------------------------
1+G1 G2 H1 + G5 G6 H2 + G3 G4 G6 H2 + G1 G2 G5 G6 H1 H2
>> % To determine the transfer function Y2(s)/R1(s) %
>> T21=-N(5,7);
>> pretty(T21)
G1 G4 G6
---------------------------------------------------------------------------------
1+ G1 G2 H1 + G5 G6 H2 + G3 G4 G6 H2 + G1 G2 G5 G6 H1 H2
Khaled Mustafa Mahmoud Session: Spring 2017/2018
50
>> % To determine the transfer function Y2(s)/R2(s) %
>> T22=-N(5,8);
>> pretty(T22)
G5 G6 + G3 G4 G6 + G1 G2 G5 G6 H1
---------------------------------------------------------------------------------
1+G1 G2 H1 + G5 G6 H2 + G3 G4 G6 H2 + G1 G2 G5 G6 H1 H2
Example 4.4: To exploit the strength advantage of robot manipulators and
the intellectual advantage of humans, a class of manipulators called
extenders has been examined. The extender is defined as an active
manipulator worn by a human to augment the human’s strength. The
human provides as in input 𝑈(𝑠), as shown in Figure 4.4. The endpoint of
the extenders is 𝑃(𝑠). Perform the following using MATLAB:
1. Determine the output 𝑃(𝑠) for both 𝑈(𝑠) and 𝐹(𝑠) in the form:
𝑃 (𝑠) = 𝑇1 (𝑠)𝑈 (𝑠) + 𝑇2(𝑠)𝐹 (𝑠)
2. Repeat part (1) if: 𝐺1 (𝑠) = 4/(𝑠 + 2)(𝑠 + 3), 𝐺𝑐 (𝑠) = (𝑠 + 0.5)/𝑠,
𝐺 (𝑠) = 2/(𝑠(𝑠 + 1)), 𝐾(𝑠) = 10, 𝐻(𝑠) = 1, 𝐸(𝑠) = 1/(𝑠 + 1), 𝐵(𝑠) = 1/𝑠.
Figure 4.4: Model of extender.
Khaled Mustafa Mahmoud Session: Spring 2017/2018
51
Solution:
From the signal flow graph in Figure 4.4, we have:
𝐸1 (𝑠) = 𝑈(𝑠) − 𝐻 (𝑠) 𝑃(𝑠) (4.13)
𝐸2 (𝑠) = 𝐹 (𝑠) − 𝐸 (𝑠)𝑃(𝑠) (4.14)
𝑃 (𝑠) = 𝐺 (𝑠) 𝐸1(𝑠) + 𝐾 (𝑠) 𝐺1 (𝑠)𝐸3 (𝑠) + 𝐺𝑐 (𝑠)𝐸2 (𝑠) (4.15)
𝐸3 (𝑠) = 𝐵 (𝑠)𝐸1(𝑠) + 𝐸2 (𝑠) (4.16)
The equations (4.13 to 4.16) can be rewritten as:
𝐸1 𝐸2 𝑃 𝐸3 𝑈 𝐹
1 0 H 0 −1 0
0 1 E 0 0 −1
−G −Gc 1 −KG1 0 0
[ −B −1 0 1 0 0]
>> syms H E G Gc G1 K B
>> M=[1 0 H 0 -1 0;0 1 E 0 0 -1;-G -Gc 1 -K*G1 0 0;-B -1 0 1 0 0];
>> N=rref(M);
>> % To determine the transfer function P(s)/U(s) %
>> TPU=-N(3,5);
>> pretty(T)
G + B G1 K
----------------------------------------------
1+ E Gc + G H + E G1 K + B G1 H K
>> % To determine the transfer function P(s)/F(s) %
>> TPF=-N(3,6);
>> pretty(T)
Gc + G1 K
----------------------------------------------
1+E Gc + G H + E G1 K + B G1 H K
Khaled Mustafa Mahmoud Session: Spring 2017/2018
52
>> % To Repeat part (1) if: G1(s)=4/(s+2)*(s+3), Gc(s)=(s+0.5)/s... %
>> % G(s)=2/(s*(s+1)), K(s)=10, H(s)=1, E(s)= 1/(s+1), B(s)=1/s %
>> syms s
>> G1=4/((s+2)*(s+3));
>>Gc=(s+0.5)/s;G=2/(s*(s+1));
>> K=10;H=1;E=1/(s+1);B=1/s;
>> M=[1 0 H 0 -1 0;0 1 E 0 0 -1;
-G -Gc 1 -K*G1 0 0;
-B -1 0 1 0 0];
>> N=rref(M);
>> % To determine the transfer function P(s)/U(s) %
>> T=-N(3,5);
>> pretty(T)
4 s2+ 100 s + 104
------------------------------------------
2 s4+ 14 s3+ 37 s2+ 209 s + 110
>> % To determine the transfer function P(s)/U(s) %
>> T=-N(3,6);
>> pretty(T)
2 s4+ 13 s3+ 108 s2+ 103 s + 6
------------------------------------------
2 s4+ 14 s3+ 37 s2+ 209 s + 110
Example 4.5: Find the overall transfer function 𝑌(𝑠)/𝑅 (𝑠) that is
equivalent to the system shown in Figure 4.5 using the connect command.
Khaled Mustafa Mahmoud Session: Spring 2017/2018
53
Figure 4.5: A multi loop feedback control system.
Solution:
>> % To determine the closed loop transfer function of the SFG for Example 4.5%
>> s=tf('s');G1=s;G2=2*s;G3=G2;G4=G1;G5=1/(s+1);
>>H1=s^0;H2=4*s^0;H3=H1;H4=H3;
>>G1.inputname='E1';G1.outputname='A';
>>G2.inputname='E1';G2.outputname='B';
>>G3.inputname='E1';G3.outputname='E';
>>G4.inputname='E2';G4.outputname='C';
>>G5.inputname='E3';G5.outputname='Y';
>>H1.inputname='C';H1.outputname='D';
>>H2.inputname='Y';H2.outputname='F';
>>H3.inputname='Y';H3.outputname='G';
>>H4.inputname='Y';H4.outputname='H';
>>sum1=sumblk('E1','R','H','+-');
>>sum2=sumblk('E2','A','B','D','++-');
>>sum3=sumblk('E3','C','E4','H','++-');
>>sum4=sumblk('E4','E','F','+-');
>>T=mineral(connect(G1,G2,G3,G4,G5,H1,H2,H3,H4,sum1,sum2,sum3,sum4,'R','Y'))
0.8333 s^2 + 0.3333 s
-------------------------------
s^2 + 1.5 s + 1
Khaled Mustafa Mahmoud Session: Spring 2017/2018
54
Homework 4.1: Consider the signal flow graph in Figure 4.6. Use MATLAB
to find the transfer function 𝑌(𝑠)/𝑅(𝑠).
Figure 4.6: Multiple loop system.
--------------------------------------------------------------------------------------------
Homework 4.2: Find the transfer function 𝑌(𝑠)/𝑅 (𝑠) using MATLAB for
the idle - speed control system for a fuel - injected engine as shown in
Figure 4.7.
Figure 4.7: Idle speed control system.
Khaled Mustafa Mahmoud Session: Spring 2017/2018
55
Homework 4.3: A system consists of two electric motors that are coupled
by a continuous flexible belt. The belt also passes over a swinging arm
that is instrumented to allow measurement of the belt speed and tension.
The basic control problem is to regulate the belt speed and tension by
varying the motor torques.
An example of a practical system similar to that shown occurs in textile
fiber manufacturing processes when yarn is wound from one spool to
another at high speed. Between the two spools, the yarn is processed in a
way that may require the yarn speed and tension to be controlled within
defined limits. A model of the system is shown in Figure 4.8. Find
𝑌2 (𝑠)/𝑅1 (𝑠) and 𝑌1 (𝑠)/𝑅2 (𝑠) using MATLAB.
Figure 4.8: A model of the coupled motor drives.
Khaled Mustafa Mahmoud Session: Spring 2017/2018