Block Scheme Reduction Exploiting the Symbolic Math Toolbox

Table of Contents

Systematic Block-Scheme Reduction Procedure - A Recap

Given a block scheme, as for example
schema_intro_Part5.png
a systematic reduction procedure to determine the overall equivalent transfer function from the selected input to the chosen output could be the following:

A First Example

Given the scheme [exercise from the written examination in date 2022/02/04]
schmea_esame_2022_02_04_grA.png
let's compute the overall equivalent transfer function from the input to the output .

Step 1: Associate a Variable to each Arc

This task should be manually fulfilled. For example, the resulting scheme can appear as the following:
schema_grA_label.png

Step 2: Write the System of Linear Equations describing the Block Scheme

This task should be manually fulfilled. According to the labeling performed in "Step 1", we obtain the following system of linear equations:
where and D are the transfer functions and , and Q are the Laplace transforms of the variables , etc.
Please pay attention: we are considering the scenario when .

Step 3: Solve the System of Linear Equations

Now we can exploit the Symbolic Math Toolbox functions to compute the desired transfer function.
Let's start defining the variables, the transfer function and writing the set of equations, according the result in Step 2.
clear
 
% -------------------------------------------------------------------
% let's define the Laplace transforms of the variables (using simply
% capital letters)
syms U1 Y1 Y2 % the input and the outputs of the system
syms E F G H L M Q % the intermediate variables
syms A B C D % the given transfer functions
% -------------------------------------------------------------------
 
% ---- the equations ----
eqn1 = A*U1 == E;
eqn2 = B*E == F;
eqn3 = E+M == G;
eqn4 = B*G == H;
eqn5 = H+Y2 == L;
eqn6 = C*L == M;
eqn7 = F-M == Q;
eqn8 = D*Q == Y1;
eqn9 = A*Y1 == Y2;
% assembling the set of equations
eqnS =[eqn1; eqn2; eqn3; eqn4; eqn5; eqn6; eqn7; eqn8; eqn9];
% ---- the equations ----
 

Important Remark

Note: we wrote down nine independent equations in ten variables. So, the resulting system of linear equations is under-determined. According to Rouche-Capelli’s theorem, the system solution will be expressed using one “free” parameter (i.e., one of the ten variables).
Remember: we are looking for the expression of the transfer function from input to output . So, if we were able to split the current set of variables, "extracting" the input from the variables to use it as a "free parameter" in the known terms of the equations, then we would have nine independent equations in nine variables. We could quickly solve the system of equations, obtaining the expression of the transfer function sought.

A very useful trick

How to split the set of variables, moving in the vector of known terms of the system of equations?
Easy! Use equationsToMatrix( )
help equationsToMatrix
--- help for sym/equationsToMatrix --- sym/equationsToMatrix - Convert linear equations to matrix form This MATLAB function converts equations eqns to matrix form. Syntax [A,b] = equationsToMatrix(eqns) [A,b] = equationsToMatrix(eqns,vars) A = equationsToMatrix(___) Input Arguments eqns - Linear equations vector of symbolic equations or expressions vars - Independent variables vector of symbolic variables (default) | vector of symbolic functions Output Arguments A - Coefficient matrix symbolic matrix b - Right sides of equations symbolic matrix Examples Convert Linear Equations to Matrix Form Specify Variables in Equations Return Only Coefficient Matrix of Equations Solve System of Equations That Are Functions of Time See also linsolve, odeToVectorField, solve, symvar Introduced in Symbolic Math Toolbox in R2012b Documentation for sym/equationsToMatrix
% ---- the set of variables -----------------
varS = [E; F; G; H; L; M; Q; Y1; Y2]; % <-- U1 is no more in the set of variables!
% We "moved" U1 in the vector of
% known terms vectB
 
% let's write the system of linear equations in matrix form!
[matA, vectB] = equationsToMatrix(eqnS, varS)
matA = 
vectB = 
Now we can solve the system of linear equations and rearrange the expression of the transfer function from to :
% compute the solution in term of the "free parameter" U1
X = simplify(linsolve(matA,vectB))
X = 
% the only solution term we are looking for
Y1SOL = collect(simplify(X(8)), U1)
Y1SOL = 
Finally, the transfer function is
TF_u1_2_y1 = subs(Y1SOL, U1, 1)
TF_u1_2_y1 = 
What if we also determine the transfer function from to ?
Note: the result is already available:
 
Y2SOL = collect(simplify(X(9)), U1);
TF_u1_2_y2 = subs(Y2SOL, U1, 1)
TF_u1_2_y2 = 

A Second Example

Given the scheme [exercise from the written examination in date 2022/02/04]
schmea_esame_2022_02_04_grA.png
let's compute the overall equivalent transfer function from the input to the output .

Step 0: Simplify the Scheme

It is advantageous to simplify the scheme before applying the reduction procedure. In fact, for linearity, we assume that the input is null, and consequently, we can eliminate some blocks and nodes from the diagram.
schema_esame_2022_02_04_grB.png

Step 1: Associate a Variable to each Arc

This task should be manually fulfilled. For example, the resulting scheme can appear as the following:
LABEL_schema_esame_2022_02_04_grB.png

Step 2: Write the System of Linear Equations describing the Block Scheme

This task should be manually fulfilled. According to the labelling performed in "Step 1", we obtain the following system of linear equations:
where and D are the transfer functions and , and H are the Laplace transforms of the variables , etc.
Please pay attention: we are considering the scenario when .

Step 3: Solve the System of Linear Equations

Now we can exploit the Symbolic Math Toolbox functions to compute the desired transfer function.
Let's start defining the variables, the transfer function and writing the set of equations, according the result in Step 2.
clear
 
% -------------------------------------------------------------------
% let's define the Laplace transforms of the variables (using simply
% capital letters)
syms U2 Y1 Y2 % the input and the outputs of the system
syms E F G H % the intermediate variables
syms A B C D % the given transfer functions
% -------------------------------------------------------------------
 
% ---- the equations ----
eqn1 = H+U2 == E;
eqn2 = B*E == F;
eqn3 = F+Y2 == G;
eqn4 = C*G == H;
eqn5 = -D*H == Y1;
eqn6 = A*Y1 == Y2;
% assembling the set of equations
eqnS =[eqn1; eqn2; eqn3; eqn4; eqn5; eqn6];
% ---- the equations ----
 

Important Remark

Note: we wrote down six independent equations in seven variables. So, the resulting system of linear equations is under-determined. According to Rouche-Capelli’s theorem, the system solution will be expressed using one “free” parameter (i.e., one of the ten variables).
Remember: we are looking for the expression of the transfer function from input to output . So, if we were able to split the current set of variables, "extracting" the input from the variables to use it as a "free parameter" in the known terms of the equations, then we would have nine independent equations in nine variables. We could quickly solve the system of equations, obtaining the expression of the transfer function sought.

A very useful trick

How to split the set of variables, moving in the vector of known terms of the system of equations?
Easy! Use equationsToMatrix( )
% ---- the set of variables -----------------
varS = [E; F; G; H; Y1; Y2]; % <-- U1 is no more in the set of variables!
% We "moved" U1 in the vector of
% known terms vectB
 
% let's write the system of linear equations in matrix form!
[matA, vectB] = equationsToMatrix(eqnS, varS)
matA = 
vectB = 
Now we can solve the system of linear equations and rearrange the expression of the transfer function from to :
% compute the solution in term of the "free parameter" U1
X = simplify(linsolve(matA,vectB))
X = 
% the only solution term we are looking for
Y1SOL = collect(simplify(X(5)), U2)
Y1SOL = 
Finally, the transfer function is
TF_u2_2_y1 = subs(Y1SOL, U2, 1)
TF_u2_2_y1 = 
What if we also determine the transfer function from to ?
Note: the result is already available:
 
Y2SOL = collect(simplify(X(6)), U2);
TF_u2_2_y2 = subs(Y2SOL, U2, 1)
TF_u2_2_y2 =