Linearising a nonlinear system
About this lesson
Transfer functions only work for linear systems, but real ones bend. Follow a water tank that drains through a hole, where the outflow grows with √h. Pick the level it normally runs at, swap the curve for its tangent there, and write the equation in small changes. Out comes G(s) = 20/(20s + 1). Then test it against the real tank: within 5 % for a small pump step, 33 % off for a big one.
A tank that drains
A pump fills a tank, and water drains out of a hole in the floor. The deeper the water, the harder it pushes, so it drains faster. We want a transfer function from pump flow q to level h.
pump flow q (m³/s) the input water level h (m) the output tank floor A = 1 m² water out of the hole: q_out = c·√h (Torricelli's law; c = 0.1 sums up the hole's size)
Read the lesson step by step
A tank that drains
A pump fills a tank, and water drains out of a hole in the floor. The deeper the water, the harder it pushes, so it drains faster. We want a transfer function from pump flow q to level h.
pump flow q (m³/s) the input water level h (m) the output tank floor A = 1 m² water out of the hole: q_out = c·√h (Torricelli's law; c = 0.1 sums up the hole's size)The equation and its blocks
Water in minus water out changes the level: A·dh/dt = q − c·√h. In the block diagram, the sum takes in minus out, the store block turns that into level, and the outflow block feeds c·√h back.
A·dh/dt = q − c·√h sum q − q_out net flow store 1/(A·s) net flow → level outflow c·√h level → flow out The outflow block is the only one that is not a plain multiply or integrate.The bend that breaks it
Outflow grows with the square root of depth: four times deeper drains only twice as fast. The curve bends, so the equation is nonlinear, and the Laplace transform cannot turn √h into anything times H(s).
h (m) q_out = 0.1·√h (m³/s) 1 0.100 2 0.141 4 0.200 4× deeper, only 2× the flow Linear means: double the cause, double the effect. √h fails that test, so no transfer function yet.Pick an operating point
First choose where the tank normally runs. With the pump at 0.1 m³/s, the level settles where outflow equals inflow: 0.1·√h = 0.1, so h₀ = 1.00 m. Nothing changes there. That resting point is the operating point.
operating point (an equilibrium) q₀ = 0.1 m³/s c·√h₀ = q₀ → h₀ = (q₀ / c)² = 1.00 m dh/dt = 0 there: in = out Every later number is a small change away from this point.Swap the curve for its tangent
Close to h₀ the curve is almost straight, so replace it by its tangent line. Its slope is c/(2√h₀) = 0.05. A small rise δh in level then adds δh/R to the outflow, with R = 2h₀/q₀ = 20 s/m².
# slope of the outflow curve at h0, numerically import math c, h0, d = 0.1, 1.0, 1e-6 f = lambda h: c * math.sqrt(h) slope = (f(h0 + d) - f(h0 - d)) / (2 * d) print(round(slope, 4)) # 0.05Write it in small changes
Now track only changes from the operating point: δh = h − h₀ and δq = q − q₀. The constants q₀ and c·√h₀ cancel, and what is left is linear: A·dδh/dt = δq − δh/R.
h = h₀ + δh, q = q₀ + δq c·√h ≈ q₀ + δh/R (the tangent) A·dδh/dt = q₀ + δq − q₀ − δh/R = δq − δh/R linear! A = 1 m², R = 20 s/m²One block: G(s)
Laplace-transform it from rest: (A·s + 1/R)·δH(s) = δQ(s). The loop reduces to one block, G(s) = R/(A·R·s + 1) = 20/(20s + 1): a first-order system with time constant A·R = 20 s.
(A·s + 1/R)·δH = δQ G(s) = δH/δQ = R / (A·R·s + 1) = 20 / (20·s + 1) gain R = 20 m per m³/s time const A·R = 20 s import control G = control.tf([20], [20, 1])Test 1: a small step
Test it. Raise the pump 10 %, to 0.11 m³/s. The real tank settles at 1.21 m; the linear model says 1.20 m. Close: near the operating point the tangent is a good copy of the curve.
# real tank vs linear model, pump 0.11 import math A, c, R, q = 1.0, 0.1, 20.0, 0.11 h, dh, dt = 1.0, 0.0, 0.01 for n in range(12000): # 120 s h += dt * (q - c * math.sqrt(h)) / A dh += dt * ((q - 0.1) - dh / R) / A print(f"{h:.2f} {1 + dh:.2f}") # 1.21 1.20Test 2: a big step
Now double the pump, to 0.2 m³/s. The real tank climbs to 4.00 m but the model says 3.00 m, and the tank is slower too: 34 s, not 20 s, to cover 63 % of its rise. Far from h₀ the tangent misleads.
# the same check with the pump doubled import math A, c, R, q = 1.0, 0.1, 20.0, 0.2 h, dh, dt = 1.0, 0.0, 0.01 for n in range(30000): # 300 s h += dt * (q - c * math.sqrt(h)) / A dh += dt * ((q - 0.1) - dh / R) / A print(f"{h:.2f} {1 + dh:.2f}") # 4.00 3.00The recipe and its limit
The recipe: find the operating point, take the slope of every curved term there, and write the equation in small changes. You get a transfer function that is good near that point only. Move far away, and linearise again there.
1 operating point: set d/dt = 0, solve 2 slope of each nonlinear term there 3 write in deviations: δh, δq 4 Laplace → G(s) error at the final level small step (+10 %) 5 % of the rise big step (×2) 33 % of the rise
5 quick questions
Choose one answer per question. You can change your choices before checking them.
01Why can't you Laplace-transform A·dh/dt = q − c·√h straight into a transfer function?
Derivatives are fine: they become s·H(s). A transfer function needs every term to be a constant times a signal or its derivatives. √h is not, so there is no G(s) until you linearise.
02With q₀ = 0.1 m³/s and outflow 0.1·√h, what is the operating point h₀?
At the operating point nothing changes, so dh/dt = 0 and inflow equals outflow: 0.1·√h₀ = 0.1, giving h₀ = 1.00 m.
03What does the tangent line replace, and why is that allowed?
Close to the operating point a smooth curve looks straight. Its slope there, c/(2√h₀) = 0.05, gives a straight-line copy: extra outflow ≈ δh/R with R = 20 s/m².
04The linear model is G(s) = 20/(20s + 1). Doubling the pump to 0.2 m³/s, it predicts 3.00 m; the real tank reaches 4.00 m. Why?
Far from h₀ the tangent lies above the curve: it says the hole drains more than it really does, so the model reaches outflow = inflow too early. The real tank must rise higher before its outflow catches up. A linear model is only trusted near its operating point; here the error is 33 % of the rise, against 5 % for the +10 % step.
05In deviation variables δh = h − h₀ and δq = q − q₀, what happens to the constants q₀ and c·√h₀?
Writing h = h₀ + δh and q = q₀ + δq, the constant parts on each side are q₀ and c·√h₀, which are equal at the operating point. They cancel, leaving A·dδh/dt = δq − δh/R.
Glossary
- Linear system
- One where doubling the cause doubles the effect and two causes add. Only linear systems have a transfer function.
- Nonlinear term
- A part of the equation that is not a constant times a signal, such as √h, h², or sin θ.
- Operating point (equilibrium)
- The steady state the system normally sits at: set every derivative to zero and solve. Here h₀ = 1 m at q₀ = 0.1 m³/s.
- Linearisation
- Replacing each nonlinear term by its tangent line at the operating point: the first two terms of its Taylor series.
- Deviation (small-signal) variable
- The change from the operating point, written with δ: δh = h − h₀. The linear model is written in these.
- Torricelli's law
- Water leaves a hole at speed √(2gh), so a tank's outflow grows with the square root of its depth.
- Hydraulic resistance R
- How much the level must rise to push one more unit of flow through the outlet, near the operating point. For this outlet R = 2h₀/q₀.
Notes and sources
- The tank is a simple model with illustrative numbers: floor area 1 m², outflow 0.1·√h m³/s. Every curve and number in the figure is computed from it: the real tank by step-by-step integration (RK4, 0.01 s), the linear model by its exact solution.
- Outflow through a hole goes as the square root of the depth (Torricelli's law: the water leaves at √(2gh)). Real holes pass a bit less than the ideal, a factor called the discharge coefficient; the constant c includes it.
- The slope R = 2h₀/q₀ is the "resistance" of the outlet near the operating point. Ogata's chapter on liquid-level systems uses exactly this value, R = 2H/Q, for turbulent flow.
- The Python on the steps is plain Python 3 with the math module (simple Euler steps of 0.01 s, accurate to the two decimals shown). The transfer function line uses the python-control library; control.linearize does the slope-taking automatically for a nonlinear model.
- N. S. Nise, Control Systems Engineering, 8th ed., Wiley (ch. 2, nonlinearities and linearization)
- K. Ogata, Modern Control Engineering, 5th ed., Pearson (§2-7 linearization of nonlinear models; §4-2 liquid-level systems)
- G. F. Franklin, J. D. Powell, A. Emami-Naeini, Feedback Control of Dynamic Systems, 8th ed., Pearson (ch. 9, nonlinear systems)
- MIT OpenCourseWare 16.06 Principles of Automatic Control (S. Hall)
- MIT OpenCourseWare 6.302 Feedback Systems (Roberge, Dawson, Lundberg)
- python-control: control.linearize
- Torricelli's law (Wikipedia)
Quiz Unlocks after the last step.