Algorithm Search⌘K

Techniqueintro

Pseudo-random binary sequence input

Also called PRBS, maximum-length binary input.

An input signal for identification that switches between two levels by a maximum-length shift register sequence, with a near white spectrum.

A pseudo-random binary sequence (PRBS) input is a test signal for system identification that takes only two values, u0+au_0 + a and u0−au_0 - a, and switches between them in the pattern of a maximum-length sequence from a linear feedback shift register. With a register of rr bits and a primitive feedback polynomial, the sequence repeats after M=2r−1M = 2^r - 1 steps. Over one period its autocorrelation takes only two values, so its spectrum is flat at every nonzero harmonic of 2π/M2\pi/M. It is therefore close to white noise, but it is deterministic, periodic, and has the smallest possible peak value for its power. A PRBS of period MM is persistently exciting of order exactly MM.

In plain words

To learn how a machine responds, you want to push it at all speeds, slow and fast, with equal force. Random noise does that, but it has spikes, and many plants can only take a limited push. A PRBS is a switch that flips between "high" and "low" in a pattern that looks random but is made by a simple shift register. Because it only ever sits at the two levels, it gives the most energy for a given limit on the push. Because the pattern repeats exactly, you can average over repeats to cut noise, and you know beforehand which frequencies it contains. Holding each value for several samples moves the energy toward slow motions.

When it applies

  • The plant tolerates two-level switching of the input, for example a valve, a heater power or a motor voltage around an operating point.
  • The model is linear, or is linear for small deviations around u0u_0; the amplitude aa must stay inside that range.
  • The number of parameters to be estimated is less than MM, since the order of persistent excitation is MM.
  • The experiment can run for at least one full period after the transient, so that the periodic properties hold for the recorded data.

The template

  1. PRBS-EXPERIMENT(⟨p⟩, ⟨a⟩, ⟨u0⟩, ⟨P⟩, ⟨m⟩)
  2. 1r ← the degree of the primitive polynomial ⟨p⟩; M ← 2^r - 1
  3. 2s(0), ..., s(r - 1) ← any bits that are not all 0
  4. 3for n ← r to m·M - 1 do s(n) ← XOR of s(n - r + i) over the terms x^i, i < r, of ⟨p⟩
  5. 4for n ← 0 to m·M - 1 do
  6. 5hold u ← ⟨u0⟩ + ⟨a⟩·(2 s(n) - 1) for ⟨P⟩ samples
  7. 6record y while u is applied; drop the first period as a transient
  8. 7return u and y for ⟨the estimator⟩

The holes are the feedback polynomial pp, which fixes the register length rr and the taps, the amplitude aa and operating point u0u_0, the clock period PP in samples, the number of periods mm, and the estimator that will use the data.

The sequence (L1 to L3). The recursion of L3 has pp as its characteristic polynomial. When pp is primitive of degree rr, every nonzero start state runs through all 2r−12^r - 1 nonzero states of the register before it repeats, so ss has period exactly MM. For r=4r = 4 and x4+x+1x^4 + x + 1 the recursion is s(n)=s(n−3)⊕s(n−4)s(n) = s(n-3) \oplus s(n-4), and the start 11111111 gives one period

1 1 1 1 0 0 0 1 0 0 1 1 0 1 0,1\ 1\ 1\ 1\ 0\ 0\ 0\ 1\ 0\ 0\ 1\ 1\ 0\ 1\ 0,

with 8 ones and 7 zeros. In every period there are 2r−12^{r-1} ones and 2r−1−12^{r-1} - 1 zeros.

The correlation (theorem). Map the bits to ±a\pm a as in L5 with P=1P = 1 and take the mean over one period. Then

ru(τ)={a2τ≡0(modM),−a2/Motherwise.r_u(\tau) = \begin{cases} a^2 & \tau \equiv 0 \pmod M, \\ -a^2 / M & \text{otherwise.} \end{cases}

The reason is the shift-and-add property of maximum-length sequences: s(n)⊕s(n+τ)s(n) \oplus s(n + \tau) is again a shift of ss for τ≢0\tau \not\equiv 0, so it has 2r−12^{r-1} ones and 2r−1−12^{r-1} - 1 zeros, and the product of the two ±1\pm 1 signals sums to −1-1 over a period.

The spectrum (theorem). Over one period the discrete Fourier transform of the ±a\pm a signal has ∣U0∣2=a2\lvert U_0 \rvert^2 = a^2 and ∣Ul∣2=a2(M+1)\lvert U_l \rvert^2 = a^2 (M + 1) for l=1,…,M−1l = 1, \ldots, M - 1. For r=4r = 4 and a=1a = 1, the values are 11 and 1616. So the power is the same at every nonzero harmonic 2πl/M2\pi l/M, and the mean is only a/Ma/M.

The clock period (L5). Holding each bit for P>1P > 1 samples multiplies the line spectrum by the envelope (sin⁡(ωP/2)/(Psin⁡(ω/2)))2\big(\sin(\omega P/2) / (P \sin(\omega/2))\big)^2, which has its first zero at ω=2π/P\omega = 2\pi/P. A rule of thumb is to pick PP so that this first zero lies a few times above the bandwidth of the plant, and to pick MPhM P h longer than the settling time of the plant, so that one period of the response does not wrap onto the next.

Persistent excitation. For n≤Mn \le M the covariance matrix Rˉn=a2((1+1M)I−1M11T)\bar R_n = a^2\big((1 + \tfrac{1}{M}) I - \tfrac{1}{M} \mathbf{1}\mathbf{1}^T\big) has the eigenvalues a2(1+1M)a^2(1 + \tfrac{1}{M}) and a2(M+1−n)/Ma^2 (M + 1 - n)/M, all positive. At n=M+1n = M + 1 the second one is 00. The order of persistent excitation is exactly MM.

Classic examples

  • Correlation analysis of the impulse response. With P=1P = 1 and a plant whose impulse response gg dies out within MM samples, the periodic cross-correlation of yy with uu is ryu(τ)=a2(1+1M) g(τ)−a2M∑jg(j)r_{yu}(\tau) = a^2 (1 + \tfrac{1}{M})\, g(\tau) - \tfrac{a^2}{M} \sum_j g(j). So gg is read off from ryur_{yu} up to a small known offset, without solving any equations. The correlation can be computed fast with the Walsh-Hadamard transform after a permutation of the samples.
  • Empirical transfer function estimate. With a whole number of periods in steady state, the input has power only at the harmonics 2πl/M2\pi l/M, the ratio Yl/UlY_l/U_l there has no leakage, and averaging over the mm periods lowers the noise variance by a factor mm.
  • Least-squares identification of ARX models and the prediction error method. A PRBS with MM larger than the number of input coefficients gives a nonsingular normal matrix, and its low crest factor gives the most input power under an amplitude limit.
  • Dither in closed-loop identification. A small PRBS added to the reference makes the closed-loop data informative while the controller keeps the plant near its operating point.

Variations

  • Random binary signal. Flip a fair coin at each clock instant. It is persistently exciting of every order, but its spectrum on a finite record is not flat.
  • Generalized binary noise. Switch the level with a fixed probability at each sample, which sets the mean time between switches and so shapes the low-frequency power.
  • De Bruijn sequences. Add the all-zero state to get period 2r2^r; the correlation is then no longer two-valued.
  • Inverse-repeat PRBS. Apply the sequence and then its negative. The period doubles, and the response to even-order nonlinearities cancels in the average.
  • Multilevel and ternary sequences. Sequences over more than two levels from shift registers over a finite field reveal static nonlinearities that a binary signal cannot see.
  • Multisine. A sum of sinusoids at chosen harmonics with phases picked to keep the peak low. It gives full control over the spectrum, at the cost of a higher crest factor than a binary signal.

Pitfalls

  • A polynomial that is not primitive. At L1, the polynomial x4+x2+1=(x2+x+1)2x^4 + x^2 + 1 = (x^2 + x + 1)^2 gives period 6 from the start 11111111, and x4+x3+x2+x+1x^4 + x^3 + x^2 + x + 1 gives period 5. The order of persistent excitation drops with the period. Take pp from a table of primitive polynomials, or check that the period is 2r−12^r - 1.
  • An all-zero start. At L2, the all-zero state maps to itself and the sequence is constant. Any other start works.
  • A period shorter than the response. If MPhM P h is shorter than the settling time, the periodic correlation in L7 returns ∑lg(τ+lM)\sum_l g(\tau + l M) instead of g(τ)g(\tau). Choose MM so that one period covers the settling time.
  • A clock period that is too short. With P=1P = 1 and a slow plant, most of the input power is above the bandwidth of the plant and the low-frequency fit has a poor signal-to-noise ratio. Raise PP at L5.
  • A record that is not a whole number of periods. The two-valued correlation and the flat line spectrum hold over whole periods only. Record mm full periods after the transient at L6.
  • The nonzero mean. The mean of the ±a\pm a sequence is a/Ma/M, not 00. Remove the sample means of uu and yy before estimating, or include an offset in the model.

Exercises

  1. Show that the matrix (1+1M)I−1M11T(1 + \tfrac{1}{M}) I - \tfrac{1}{M} \mathbf{1}\mathbf{1}^T of size nn has the eigenvalues 1+1M1 + \tfrac{1}{M} and (M+1−n)/M(M + 1 - n)/M, and conclude that the order of persistent excitation of a PRBS is MM.
  2. Generate the sequence of x5+x2+1x^5 + x^2 + 1 from the start 1111111111 and check that its period is 31.
  3. For a plant with impulse response g(j)=0.5jg(j) = 0.5^j for j≥1j \ge 1 and a PRBS with M=15M = 15 and a=1a = 1, compute the periodic cross-correlation at τ=1\tau = 1 and recover g(1)g(1) from it.

References

  1. Keith Godfrey (editor), Perturbation Signals for System Identification, Prentice Hall, 1993, the chapters on maximum-length binary sequences, their correlation and spectral properties, and their use as test signals
  2. Torsten Söderström and Petre Stoica, System Identification, Prentice Hall, 1989, Chapter 5 (input signals: the pseudo-random binary sequence, its covariance function and its order of persistent excitation)
  3. Lennart Ljung, System Identification: Theory for the User, second edition, Prentice Hall, 1999, Chapter 13 (experiment design and the choice of input signals)

About this page

The build computes these levels from the evidence in the repository. Each row says what the next level needs. Read what the levels mean.

LadderLevelWhat the next level needs
Human proofH0 no proof
  • add a proof in proofs/ (06.5)
LeanL0 no Lean part
  • name a Lean module in the lean field (07)
VisualV0 none
  • add viz/scene.ts or a figure (10)
WritingW3 standard
  • five exercises