Block Scheme Reduction Exploiting the Symbolic Math Toolbox
Systematic Block-Scheme Reduction Procedure - A Recap
Given a block scheme, as for example
a systematic reduction procedure to determine the overall equivalent transfer function from the selected input to the chosen output could be the following:
- assign an intermediate variable to each oriented arc in the scheme that is not yet associated with a variable (the input and output arcs already have a corresponding variable);
- write the relationships (in terms of the Laplace transform) between the inputs, the intermediate variables and the outputs. Take into account the topological structure of the scheme (presence of summation or interconnection nodes) and each transfer function acting in the scheme itself;
- reduce the system of linear equations already obtained by substituting every intermediate variable with a suitable expression using only the input and output variables.
A First Example
Given the scheme [exercise from the written examination in date 2022/02/04]
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:
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.
% -------------------------------------------------------------------
% let's define the Laplace transforms of the variables (using simply
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 ----
% 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
% 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))
% 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]
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.
Step 1: Associate a Variable to each Arc
This task should be manually fulfilled. For example, the resulting scheme can appear as the following:
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.
% -------------------------------------------------------------------
% let's define the Laplace transforms of the variables (using simply
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 ----
% 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
% 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 =
