Synthetic first-order step response
G(s) = 1/(s+1) is driven by a unit step for 8 seconds at a sample time of 0.02 seconds. Measurement noise has standard deviation 0.02 and seed 4. The clean output is 1 − exp(−t). The CSV is a synthetic identification record.
What this page generates
A first-order lag is the smallest interesting linear system. In time domain the equation is dy/dt = −y + u. With u = 1 for t ≥ 0 and y(0) = 0, the solution is y(t) = 1 − e^(−t). At t = 1 the clean output is about 0.632. At the end of this 8 second run it is within half a percent of 1. The noisy column jitters around that curve by about 0.02.
The simulator does not paste the closed form into the table. It builds the controllable canonical state space, here a 1 by 1 matrix A = [−1], B = [1], C = [1], D = 0, and integrates with RK4 while holding u constant between samples. That is the same integrator used for the higher-order pages, so a bug in the step size shows up here first, where the truth is easy. The sample time 0.02 is far smaller than the one-second time constant, so the discrete trajectory matches 1 − e^(−t) closely.
Columns are time, input, output_clean, and output. Identification code should train on output and report error against output_clean if it wants a score that is not just “did you fit the noise.” The banner on the file is part of the data, not an optional caption. Seed 4 repeats the noise and does not change the step, which is deterministic.
Generating rule
Plant
G(s) = 1 / (s + 1), u(t) = 1
Check values
Worked numbers
Seed 4 produced 401 rows from t = 0 to t = 8.00. The clean output peaks at 1.000 and ends at 1.000. The input changes value 0 times. Those figures describe this seed only; they are not a laboratory trial.
Parameters and defaults
| Parameter | Default | Range | Effect |
|---|---|---|---|
| numerator | 1 | proper transfer function | Gain. The DC gain here is 1/1 = 1. |
| denominator | 1, 1 | highest power first | s + 1. The time constant is 1. |
| input | step, amplitude 1 | step, PRBS, sine | Held at 1 for the whole record, including t = 0. |
| dt | 0.02 s | > 0 | RK4 step and the row spacing. |
| duration | 8 s | longer than one step | Long enough to see the approach to 1. |
| noise std | 0.02 | ≥ 0 | Measurement noise on the output only. |
| seed | 4 | unsigned 32-bit | Repeats the measurement noise. |
Python for this seed
Full script with mulberry32() & box_muller() available via Copy Python above
# SYNTHETIC DATA - generated by MockDataLab (mockdatalab.com)
# This file is synthetic and must not be presented as real measurements, clinical data, or results from a physical instrument.
# generator: control-transfer-function
# seed: 4
# G(s) = (1) / (s + 1)
# numerator (highest power first): 1
# denominator (highest power first): 1, 1
# input: step amplitude=1
# integrator: RK4 with zero-order hold
# mulberry32() and box_muller() are included when you copy the full script.
SEED = 4
DT = 0.02
STEPS = 400
NOISE = 0.02
A = np.array([[-1.0]], dtype=np.float64)
B = np.array([1.0], dtype=np.float64)
C = np.array([1.0], dtype=np.float64)
D = 0.0
def input_at(i, t):
return 1.0
def deriv(x, u):
return A @ x + B * u
def rk4(x, u, dt):
k1 = deriv(x, u)
k2 = deriv(x + 0.5 * dt * k1, u)
k3 = deriv(x + 0.5 * dt * k2, u)
k4 = deriv(x + dt * k3, u)
return x + (dt / 6.0) * (k1 + 2.0 * k2 + 2.0 * k3 + k4)
rng = mulberry32(SEED)
state = np.zeros(A.shape[0], dtype=np.float64)
time = np.empty(STEPS + 1, dtype=np.float64)
inp = np.empty(STEPS + 1, dtype=np.float64)
clean = np.empty(STEPS + 1, dtype=np.float64)
output = np.empty(STEPS + 1, dtype=np.float64)
for i in range(STEPS + 1):
t = i * DT
u = float(input_at(i, t))
y = float(C @ state + D * u)
time[i] = t
inp[i] = u
clean[i] = y
output[i] = y + (NOISE * box_muller(rng) if NOISE > 0 else 0.0)
if i < STEPS and state.size:
state = rk4(state, u, DT)
columns = ["time", "input", "output_clean", "output"]
data = np.column_stack([time, inp, clean, output])
Exercises
- EXERCISE 01Check an identification script against the known time constant of 1 second.
- EXERCISE 02Plot 1 − exp(−t) on top of output_clean and look for integrator error.
- EXERCISE 03Show a class the 63 percent rule on a file they can regenerate.
Questions
Why isn’t the first output exactly 0?
output_clean at t = 0 is 0 because the state starts at 0 and D is 0. The measured output adds noise, so it is a small random number, not a jump in the plant.
Is the input included?
Yes. The input column is 1 on every row. A file of outputs alone is not an identification record.
What happens if I lengthen the time constant?
Edit the denominator to 1, a with a smaller than 1, for a slower lag. The closed form changes with it. This page’s essay is about a = 1.
Related
- underdamped second-order step
- an exponential written as a formula instead of a plant
- a binary input with more frequency content
- control bench
- download the lag CSV
- Static CSV for seed 4
SYNTHETIC DATA - generated by MockDataLab (mockdatalab.com). Do not present the download as a real measurement.