Skip to content
Tutorials Center
My learning

Topics

Lesson 9 of 37 ยท Modelling and Transfer Functions

Signal Flow Graphs and Mason's Rule

Draw signal flow graphs, identify forward paths and loops, and use Mason's gain formula to get transfer functions, with a Python implementation to check it.

Block diagram reduction works well for simple layouts, but with many interlocking loops the sequence of moves becomes error-prone. A signal flow graph (SFG) is an alternative picture, and Mason's gain formula reads the overall transfer function straight off it with no step-by-step reduction. This lesson explains the vocabulary, the formula, and an implementation you can run.

Signal flow graph vocabulary

An SFG is a set of nodes (variables) joined by directed branches, each with a gain.

  • Node: a signal. The value at a node is the sum of all signals arriving on branches.
  • Branch: a directed edge with a gain (a transfer function such as G1(s)).
  • Input node (source): has only outgoing branches.
  • Output node (sink): has only incoming branches.
  • Forward path: a path from the input node to the output node that passes through each node at most once. Its gain is the product of the branch gains.
  • Loop: a closed path that starts and ends at the same node and visits others at most once. Its gain is the product of its branch gains.
  • Non-touching loops: loops that share no node.

Mason's gain formula

Text
T = ( sum over k of P_k * Delta_k ) / Delta
  • P_k is the gain of the k-th forward path.
  • Delta is the determinant of the graph:
Text
Delta = 1 - (sum of all loop gains)
          + (sum of products of every pair of non-touching loops)
          - (sum of products of every triple of non-touching loops) + ...
  • Delta_k is Delta computed with only the loops that do not touch the k-th forward path.

Mason's formula in words

Forward paths P_k Input to output, each node once.
Loops L_i Closed paths with their gains.
Delta 1 minus loops plus non-touching pairs.
Delta_k Delta without loops touching path k.

T equals the sum of P_k Delta_k over Delta.

1 / 2

A small example by hand

Take the simplest feedback loop: the forward path is G (from input through G to output) and the feedback branch has gain -H. There is one forward path with P1 = G and one loop L1 = -G H. The loop touches the path, so Delta_1 = 1. Then Delta = 1 - L1 = 1 + G H and

Text
T = G * 1 / (1 + G H)

which is the feedback formula we already know. Mason's rule contains the series, parallel and feedback rules as special cases.

Implementing Mason's rule

Mason's method is purely graph-theoretic, so a program can do it. The code below finds all forward paths and simple loops with a depth-first search, builds Delta, and then compares the answer with the brute-force approach of solving the node equations as a linear system. The graph has a forward chain R -> a -> b -> c -> d and three feedback or self branches that create loops, some of which do not touch.

Python Mason's rule versus solving the equations

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

The graph has three loops (the self-loop on a, the loop c-d, and the loop a-b-c) and a single forward path. The self-loop and the c-d loop do not touch, so they contribute a pair term to Delta. Both methods give the same number, which is a good check on a hand calculation.

Worked symbolic example

For the graph above with branch gains written symbolically, the loops are L1 = -H3 (self-loop at a), L2 = -G3 H1 (loop c-d) and L3 = -G1 G2 H2 (loop a-b-c). The only non-touching pair is (L1, L2). The single forward path is P1 = G1 G2 G3 and it touches every loop, so Delta_1 = 1. Therefore

Text
Delta = 1 - (L1 + L2 + L3) + L1 L2
T = G1 G2 G3 / Delta

Mason's rule on the standard feedback system

For the standard loop with controller C, plant G and sensor H there is one forward path P1 = C G and one loop L1 = -C G H, which recovers the closed-loop formula.

Python Mason's rule on a three-loop example, with numbers

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

If you change the code in the previous example to s = 1.0j and run it, T_mason equals this value.

Check your understanding

Quick check ยท 4 questions

of 4 answered You scored / 4 ยท perfect!

  1. 1. In Mason's formula, what is Delta_k?

    Delta_k is the determinant of the part of the graph that is untouched by forward path k.
  2. 2. Two loops are non-touching when

    Non-touching loops share no common node.
  3. 3. A graph has one forward path G and one loop of gain -G H touching it. What is T?

    Delta = 1 - (-G H) = 1 + G H, and Delta_1 = 1, so T = G / (1 + G H).
  4. 4. With loops L1, L2, L3 where only L1 and L2 are non-touching, Delta equals

    The pair term has a plus sign. L3 touches both loops, so there are no other pairs or triples.

Summary

  • A signal flow graph shows variables as nodes and gains on directed branches.
  • Mason's formula is T = sum(P_k Delta_k) / Delta, with Delta = 1 - sum(loops) + sum(non-touching pairs) - ....
  • Delta_k omits loops that touch forward path k.
  • The method needs no step-by-step reduction, but you must list every loop.
  • A program can enumerate paths and loops, and a linear solve of the node equations gives an independent check.

Next: Test Signals and the First-Order Response