Gain and time constant
A first-order system has the transfer function
where K is the gain and τ is the time constant. Its only pole is at s = −1/τ. For a unit step input, whose transform is 1/s, the output is Y(s) = K/(s(1 + τs)). Its partial fraction expansion gives
The output settles at K times the input, which is why K is called the gain. It reaches 1 − 1/e, about 63%, of this value at t = τ, and 99.33% at t = 5τ. For all practical purposes the system has settled by 5τ, which is why τ is called the time constant.
Writing the response as y(t) = K − Ke−t/τ splits it into a steady state response K and a transient response −Ke−t/τ that dies away. Because a step is easy to generate, we can often find K and τ for a real system by giving it a step and measuring the output. The card at the bottom of this tab lets you try this.
The system
- pole
- —
- final value
- —
- y(τ)
- —
- y(5τ)
- —
What to notice
Change K with τ fixed. The whole curve is stretched vertically, but the times at which it reaches 63% and 99.3% of its final value do not move. The pole does not move either: the gain sets how far the output goes, not how fast it gets there.
Change τ with K fixed. The final value stays the same, but the curve is stretched horizontally. As τ grows, the pole at −1/τ moves towards the origin. A pole close to the origin means a slow system; a pole far to the left means a fast one.
Turn on the tangent. The response starts with slope K/τ, so if it kept rising at its initial rate it would reach its final value at exactly t = τ. Instead it slows down as it approaches K, and is only at 63% by then.
Turn on the two parts. The steady state response is flat and the transient response starts at −K and decays to zero. Their sum is y(t), and it starts at zero, as it must for a system initially at rest.
Hint: estimate the final value first. Then find the time at which the output reaches 63% of it.
Try these
- Exercise 5 in Section 8.13: when given a step input, a first-order system reaches 63% of its asymptotic value of 4.25 units at time 3 s. Set the sliders to match, and write down its transfer function.
Show answer
The asymptotic value is K times the unit step, so K = 4.25. The output reaches 63% of its final value at t = τ, so τ = 3 s. The transfer function is G(s) = 4.25/(1 + 3s), with a pole at −1/3. The readout shows y(τ) = 2.6865 = 0.6321 × 4.25. - Start from Figure 8.3 and double the time constant to τ = 4. Where does the pole go, and how long does the system now take to settle?
Show answer
The pole moves from −0.5 to −0.25, half as far from the origin. The system now takes 5τ = 20 s to reach 99.3% of its final value, twice as long as before. Choose the 0 to 20 s time axis to see this. The final value is still 2.5. - Does the time at which the output reaches 63% of its final value depend on K? Use the sliders, then explain from EQ 8.8.
Show answer
No. From EQ 8.8, y(t)/K = 1 − e−t/τ, which depends only on t/τ. The fraction of the final value reached at any time is the same for every gain, so y(τ)/K = 1 − 1/e ≈ 0.632 whatever K is. - Turn on the tangent at t = 0. Where does it cross the dashed final-value line, and why?
Show answer
Differentiating EQ 8.8 gives y′(t) = (K/τ)e−t/τ, so the initial slope is K/τ. A line from the origin with this slope reaches height K at t = τ. This gives a second way to read τ off a measured step response. - In the card above, press New system a few times and identify each one. Which of the two parameters is easier to estimate when the noise is on, and why?
Show answer
The gain is usually easier, because once the response has settled you can average many measurements to estimate the final value, and the noise averages out. The time constant depends on reading the single time at which the output crosses 63% of that value. Near that point the curve is fairly flat, so a small error in height becomes a larger error in time, and any error in your estimate of K carries over into τ too.
A first-order system on your desk: the temperature of a CPU
When a processor works, almost all the electrical power it draws is turned into heat. That heat warms the chip and its heatsink, and the heatsink and fan pass it on to the surrounding air. We can model this with three quantities.
Power P, in watts (joules per second), is the rate at which the chip produces heat. It is low when the machine is idle and high when every core is busy.
Heat capacity C, in joules per kelvin, is the energy needed to warm the chip and heatsink by one degree. A large lump of copper has a large C. If the temperature T rises at rate dT/dt, heat is being stored at rate C dT/dt.
Thermal resistance R, in kelvin per watt, describes how hard it is for heat to escape. Heat leaves at a rate proportional to how much hotter the chip is than the air at temperature Ta, namely (T − Ta)/R. This is Newton's law of cooling. A bigger heatsink or a faster fan means a smaller R.
Energy is conserved, so the heat produced must either be stored or escape:
Write θ = T − Ta for the temperature rise above the air and multiply through by R:
Taking the Laplace transform with θ(0) = 0 gives RCsΘ(s) + Θ(s) = R P(s), so the transfer function from power to temperature rise is
This is EQ 8.7 with gain K = R and time constant τ = RC. The system is linear, so we can start from the idle steady state and look only at changes. If the power steps up by ΔP, EQ 8.8 says the temperature rises by
When the load stops, the power steps down by ΔP and the temperature falls back with the same time constant. If you have met electrical circuits, this is the RC circuit with temperature in place of voltage and heat flow in place of current.
The model
- τ = RC
- —
- rise RΔP
- —
- hottest
- —
- settles by 5τ
- —
What to notice
Change C. The final temperature does not move, but the approach to it is slower: more copper takes longer to warm up. Change R. Now both change: a poorer heatsink makes the machine hotter in steady state and, since τ = RC, slower to get there. Change ΔP. Only the size of the rise changes, because the system is linear.
Make the load shorter than about 5τ. The temperature never reaches its final value before the load stops, so you cannot read RΔP off the curve. When you run the experiment, keep the load on for at least five time constants.
Turn on two masses. The small die heats up within a second or two, long before the heatsink does, so the curve jumps at the step and then rises slowly. A first-order model cannot produce such a jump. The system now has two poles on the negative real axis, one far from the origin and one close to it, which is the overdamped case of the next tab. Most real machines behave like this.
The experiment
You will idle your computer, load every core for a few minutes, then let it cool, while logging the CPU temperature once a second. The script below does all of this and writes cpu_log.csv with three columns: time_s, temp_C, and load (1 while the cores are busy, 0 otherwise).
- Plug the machine in, close other programs, and put a laptop on a hard, flat surface so that its vents are clear.
- Leave it idle for a few minutes so that it starts from a steady temperature.
- Run
python3 cpu_step.pyand leave the machine alone for the 11 minutes it takes. Ctrl-C stops it early and releases the cores. - Paste
cpu_log.csvinto the analysis panel below, or load the file.
If the temperature reaches a flat ceiling, usually somewhere near 90 to 100 °C, the processor is throttling: it is cutting its own power to protect itself, and the model no longer applies. Set WORKERS to half the number of cores and run it again. If the fan speeds up a lot during the run, note this too; the Try these questions return to it.
Reading the temperature. read_temp() works on most Linux machines, including a Raspberry Pi, using psutil if it is installed and /sys/class/thermal otherwise. A virtual machine, WSL or a container usually cannot see the sensor, so run the script on the machine itself. Other systems need a separate tool:
- Intel Macs:
sudo powermetrics --samplers smcreports the CPU die temperature. - Apple Silicon Macs: macOS has no built-in command for this. Third-party command-line tools such as
macmonoriSMCcan report temperatures. - Windows: use a hardware monitor that can log to a CSV file.
On these systems you can either change read_temp() to call the tool, or run the script for the load alone and log the temperature with the tool. In the second case, build a CSV file with the same three columns, setting load from the times the script prints.
The analysis
We fit EQ 8.8 separately to the heating part (from the moment the load starts) and the cooling part (from the moment it stops), as T(t) = T0 + Δ(1 − e−t/τ), where Δ is negative while cooling. For a fixed τ the model is linear in T0 and Δ, so least squares gives them directly. We then search for the τ that leaves the smallest squared error. As a check that needs no fitting at all, we also read off the time at which the data first reach 63% of the fitted rise. If you know the power step ΔP, for example from a power meter or a tool that reports CPU power, the total rise from idle, ΔT, gives R = ΔT/ΔP, and then C = τ/R.
The sample log is simulated, not measured: a two-mass model of a laptop (the simulator above with ΔP = 25 W, R = 1.6 K/W, C = 30 J/K and two masses turned on), read once a second by a sensor that reports whole degrees. Replace it with your own log.
The fit
- idle temperature
- —
- jump at the step
- —
- τ heating
- —
- τ cooling
- —
- rise Δ (fit)
- —
- 63% point
- —
- R = ΔT/ΔP
- —
- C = τ/R
- —
Reading your results
Look at the residuals first. If they are scattered evenly about zero, a first-order model describes your machine well, and τ and the rise are its time constant and its gain times ΔP.
A jump at the step, followed by a systematic pattern in the residuals in the first few seconds, means the die heats up faster than the heatsink. The fit then describes the slow heatsink, and the jump is roughly ΔP times the thermal resistance between the die and the heatsink. The sample log shows this.
Compare the heating and cooling time constants. For a linear system they are equal. If cooling is clearly slower, the fan probably slowed down as the machine cooled, raising R. Then R depends on the temperature, and the system is not linear.
The output of the Python code is computed from the data shown in the plot, so you can check it against your own run.
Try these
- A laptop's heatsink has heat capacity 25 J/K and thermal resistance 1.6 K/W. Its CPU draws 25 W more when all its cores are busy. Predict the time constant and the eventual temperature rise, then check with the simulator.
Show answer
τ = RC = 1.6 × 25 = 40 s, and the rise is RΔP = 1.6 × 25 = 40 K. Starting from 45 °C, the CPU heads for 85 °C. It reaches 45 + 0.632 × 40 ≈ 70 °C after 40 s, and is within 1% of 85 °C after 5τ = 200 s. - Using the sample log, the fitted rise is about 33 K but the temperature actually climbs about 40 K from idle. Where did the rest go?
Show answer
About 6.5 K of it appears as an almost immediate jump when the load starts. The die is small and heats up within a second or so, before the heatsink has warmed at all, and a single exponential cannot follow this. The fit therefore starts from a baseline above idle and describes only the slow heatsink. In the simulated laptop, about 8 K of the rise comes from the die (time constant about 1 s) and about 32 K from the heatsink (time constant about 36 s). The fit recovers these roughly, as a jump of 6.5 K, a rise of 33.4 K and τ = 34.5 s. The match is not exact because, with one reading a second, only one or two readings fall inside the fast part. - Fit your own log. Are the heating and cooling time constants equal? If not, which is longer, and what might explain the difference?
Show answer
There is no single right answer, since it depends on your machine. For a linear system with constant R and C, the two should agree to within the noise. On many laptops the fan speeds up as the temperature rises, which lowers R during the hot part of the run. In that case the heating curve settles sooner than the cooling curve, because the fan slows again as the machine cools. Turbo boost, which raises the power for the first part of a burst, and throttling near the temperature limit also break the model. - Suppose you used only half the cores, so that ΔP is roughly halved. What should happen to the rise and to the time constant? Run it to see whether your machine agrees.
Show answer
If the system is linear, the rise halves and the time constant stays the same, because τ = RC does not depend on the input. If your measured τ changes noticeably with the load, something in the system depends on temperature, most often the fan. - Why does the script keep the load on for 300 s? What would go wrong with 30 s on a machine whose time constant is 40 s?
Show answer
We need the temperature to come close to its final value to measure the rise, and that takes about 5τ. With a 30 s burst the temperature reaches only 1 − e−30/40 ≈ 53% of its final rise before the load stops. The fit then has to extrapolate both the rise and τ from the early part of the curve, where they are hard to tell apart, and the estimates become much less certain. Try it in the simulator by setting the load to 30 s.
Gain, natural frequency and damping ratio
A second-order system arises when a system accumulates energy and then releases it, like a violin string excited by a bow. Its transfer function is
with gain K, natural frequency ωn in radians per second, and damping ratio ζ. Multiplying through by ωn2, its poles are the roots of s2 + 2ζωns + ωn2, namely
The value of ζ decides whether these are complex, repeated or real, and so which of four forms the unit step response takes.
Undamped, ζ = 0. The poles are at ±jωn and y(t) = K(1 − cos ωnt) (EQ 8.10): an oscillation at ωn that never dies away.
Underdamped, 0 < ζ < 1. The poles are at −ζωn ± jωd, where ωd = ωn√(1 − ζ2), and
a sinusoid at ωd inside a decaying envelope e−ζωₙt.
Critically damped, ζ = 1. A double pole at −ωn, and y(t) = K[1 − e−ωₙt − ωnte−ωₙt] (EQ 8.12).
Overdamped, ζ > 1. Two real poles at −(ζ ± γ)ωn, with γ = √(ζ2 − 1), and y(t) is the difference of two decaying exponentials (EQ 8.13).
The system
- poles
- —
- ω_d (rad/s)
- —
- decay rate ζω_n
- —
- largest y(t) on the plot
- —
What to notice
Slide ζ slowly from 0 to 1 and watch the s-plane. The two poles move along a semicircle of radius ωn, making the angle θ = cos−1ζ with the negative real axis. Their real part −ζωn sets how fast the envelope shrinks, and their imaginary part ±ωd sets how fast the response oscillates. As ζ grows, the oscillations die out sooner and slow down slightly.
At ζ = 1 the poles meet at −ωn and the oscillation disappears. Beyond 1 they split along the real axis: one moves left and the other moves right, towards the origin. The one near the origin is slow, so the response becomes more and more sluggish as ζ increases. This is why critical damping is the best of both worlds: as fast as possible without overshooting.
Change ωn with ζ fixed. The poles move along a straight line through the origin and the response keeps its shape but is squeezed or stretched in time. Change K and only the vertical scale changes. So K sets where the output ends up, ωn sets the time scale, and ζ sets the shape.
Try these
- Press the Figure 8.4 preset (K = 2.5, ωn = 2, ζ = 0). What is the period of the oscillation, and what is the largest value the output reaches?
Show answer
From EQ 8.10, y(t) = 2.5(1 − cos 2t). The period is 2π/ωn = π ≈ 3.14 s, and the output swings between 0 and 2K = 5, reaching 5 at t = π/2, 3π/2, and so on. The poles are on the imaginary axis at ±2j, so nothing damps the oscillation. - Set ζ = 0.2 with K = 2.5 and ωn = 2. The text says this system is still oscillating at t = 10. What is the period of the oscillation, and roughly how many periods fit into the first 10 seconds?
Show answer
ωd = 2√(1 − 0.04) = 1.960 rad/s, so the period is 2π/1.960 = 3.21 s, slightly longer than in the undamped case. About 10/3.21 ≈ 3.1 periods fit into the first 10 seconds. The envelope has shrunk by e−0.4×10 ≈ 0.018 by then, but you can still see the oscillation if you choose the 0 to 20 s axis. - Choose the Fig. 8.5 family overlay. As ζ goes from 0.2 to 1, which curves overshoot the final value, and by roughly how much?
Show answer
Every underdamped curve overshoots, though some only slightly. With K = 2.5 the peaks are about 3.82 for ζ = 0.2, 3.13 for 0.4, 2.54 for 0.8 and 2.5002 for 0.95, which are overshoots of about 53%, 25%, 1.5% and 0.007%. Set each value of ζ and read the largest value from the readout to check. The critically damped curve, ζ = 1, never overshoots. - Set ζ = 0.4 and change ωn from 2 to 4. What happens to the poles, and to the time at which the output first peaks?
Show answer
Both poles move twice as far from the origin, from −0.8 ± 1.833j to −1.6 ± 3.666j, keeping the same angle θ = cos−10.4 ≈ 66°. EQ 8.11 depends on time only through ωnt, so the response has the same shape on a time axis compressed by 2, and the first peak moves from about 1.71 s to about 0.86 s. The height of the peak does not change. - Set K = 2.5, ωn = 2 and ζ = 3. The response looks like that of a first-order system. Estimate its time constant from the pole closer to the origin, then check your estimate in the first-order tab.
Show answer
With γ = √8 = 2.828, the poles are at −(3 ± 2.828) × 2, that is −11.66 and −0.343. The far pole's term in EQ 8.13 dies away within a fraction of a second, leaving roughly K(1 − e−0.343t), a first-order response with τ ≈ 1/0.343 ≈ 2.9 s. In the first-order tab, K = 2.5 and τ = 2.9 give a curve that is very close on the 0 to 20 s axis. The slow pole near the origin dominates the response.