Rx₁x₂x₃x₄Y11/s11/s1−1−2−11
T(0) = 2/3012345600.20.40.60.8time (s)output YUNIT-STEP RESPONSE y(t)graph, node by nodeMason's T(s)
Lit arrows with moving dashes: the path or loop this step is aboutRound nodes are signals; each one adds the signals arriving on its arrowsPlot: unit-step response of the graph and of Mason's T(s), computed from the modelThe token multiplies the gains it crosses; the running product is in the readoutA signal-flow graph: round nodes are signals, arrows multiply by their gains, and every node adds what arrives. Mason's gain rule reads the answer straight off the graph: T = Σ Pₖ Δₖ / Δ, from the forward paths, the loops and which loops touch. The plot shows the graph simulated node by node and Mason's T(s) giving the same step response. Block-diagram reduction (see Reducing block diagrams to one block) gives the same T(s): the inner loops become 1/(s + 1) and 1/(s + 2), and closing the outer loop gives (s + 2)/(s² + 3s + 3). Mason's rule gets there without redrawing.

The graph

  1. A signal-flow graph draws a system as dots and arrows. Each dot, called a node, is a signal. Each arrow, called a branch, multiplies its signal by the gain written on it. We want one answer: T = Y/R.

Paths and loops

Mason's rule

Check it

What is happening

# step 1/11 · graph
# about: Input R, Output Y

node     a signal (R, x₁ … x₄, Y)
branch   an arrow with a gain:
         head signal = gain × tail signal

this graph   6 nodes, 9 branches
goal         T(s) = Y(s)/R(s)

The same system as a block diagram:
two lags 1/(s + 1) and 1/(s + 2) in a row,
a feedforward from R into the second,
all inside unity negative feedback.

The branch gains are illustrative round numbers, not a measured machine. Every number and curve in the figure is computed from them. The Python is plain Python 3. Each gain is a list of coefficients of 1/s, lowest power first, so [1, 3, 3] means 1 + 3/s + 3/s². Multiplying by s² turns that list into s² + 3s + 3.