System Properties Lab

Computer Systems Modelling · Section 5.3 · Interactive lab

Systems: testing for linearity, time invariance and causality

A system is a function that maps an input signal x(t) to an output signal y(t) = H(x(t)). Each property in Section 5.3 is a claim about what H does to every possible input. In this lab you treat H as a black box, feed it inputs, and compare the outputs. A failed comparison proves that the system lacks the property. A passed comparison is only evidence, because a different input might fail.

How it works and what to try

How it works: In four tabs. (1) Linearity: pick a system, two inputs and two constants, and compare H(k1x1 + k2x2) with k1H(x1) + k2H(x2), with their difference plotted beneath. (2) Time invariance: compare delaying the input and then applying the system with applying the system and then delaying the output. (3) Causality and memory: add a small bump to the input and see where the output changes. (4) Classify them all: mark nine systems as causal, memoryless, time-invariant and linear, then check. Each tab shows the matching Python code, with its output.

Try this: Load Example 5.6 and see squaring fail superposition. Drive the saturation system with k1 = 0.5 and then 2 to see why limiting the output breaks homogeneity. Check that the offset y = x + 1 is not linear, even though its graph is a straight line. Compare the moving average of the last second with the centred average computed from a log.

Section and example numbers refer to Chapter 5 of S. Keshav, Mathematical Foundations of Computer Networking, Addison-Wesley, 2012.

Additivity, homogeneity and superposition

A system is additive if, whenever input x1 gives output y1 and input x2 gives output y2, the input x1 + x2 gives the output y1 + y2. It is homogeneous if the input kx gives the output ky for every scalar k. A system is linear if it has both properties. They combine into the single condition of superposition:

if y1 = H(x1) and y2 = H(x2), then k1y1 + k2y2 = H(k1x1 + k2x2)

The test bench below computes both sides. The orange curve passes the combined input through the system. The dashed pink curve passes each input through separately and combines the outputs. For a linear system the two curves coincide for every choice of inputs and constants.

Example 5.6 asks whether H(x) = x2 is linear. Since (k1x1 + k2x2)2 is not the same as k1x12 + k2x22, it is not. Press the Example 5.6 button to see the two sides disagree.

2
1
Test one property at a time
—
Inputsx₁(t), x₂(t), and the combined input k₁x₁ + k₂x₂ (grey)
OutputsH(k₁x₁ + k₂x₂) and k₁H(x₁) + k₂H(x₂) (dashed)
DifferenceH(k₁x₁ + k₂x₂) − (k₁H(x₁) + k₂H(x₂)); zero everywhere for a linear system
Python · the superposition test

    

What to notice

Choose the saturation system with a sine input and press the homogeneity button. With k1 = 0.5 the output never reaches the limit and the test passes. With k1 = 2 the output is clipped and the test fails. This is the book's point that any system that limits its output to some maximum or minimum is not homogeneous, and so is not linear.

Since real systems always saturate somewhere, most real systems are not linear. They are often close to linear near an operating point, which is why we can still model them as linear. Section 8.2.2 does this with a first-order Taylor expansion, a technique called linearization.

The offset system y = x + 1 looks linear because its graph is a straight line, but it fails both tests. Try k1 = k2 = 0: a linear system must give zero output for zero input.

Try these

  1. Before using the lab, decide whether the time-varying gain y(t) = t·x(t) is linear. Then check.
    Show answer
    It is linear. H(k1x1 + k2x2) = t(k1x1 + k2x2) = k1·tx1 + k2·tx2. The gain changes with time, but at each instant it is still a multiplication. The difference curve stays at zero. You will see in the next tab that this system is not time-invariant, so linearity and time invariance are separate properties.
  2. For the squaring system with x1 = x2 = the burst, k1 = 2 and k2 = 1, predict the largest difference before reading it off the lab.
    Show answer
    During the burst both inputs are 1, so the combined input is 3 and H gives 9. The other side gives 2·1 + 1·1 = 3. The difference is 6, and it is zero outside the burst.
  3. Find a choice of inputs and constants for which the squaring system passes the test, even though it is not linear. What does this tell you about using tests to establish a property?
    Show answer
    One choice is k1 = 1 and k2 = 0, which reduces the test to H(x1) = H(x1). Another is k1 = 1 and k2 = −1 with x1 = x2, when both sides are 0. A single passing test cannot show that a system is linear, because linearity is a claim about all inputs and all constants. A single failing test is enough to show that it is not linear. To prove linearity you need an algebraic argument like the one in answer 1.
  4. Is the moving average of the last second linear? Explain why without the lab, then confirm.
    Show answer
    Yes. The output is an integral of the input over a window, and integration is linear: the integral of k1x1 + k2x2 is k1 times the integral of x1 plus k2 times the integral of x2.