Separate time within the move from the number of the move
Let \(k=0,\ldots,N-1\) index input samples during a single pass, and let \(j\) count completed learning updates between passes. Before every pass return the stage to the same initial state. The reference trajectory, sampling period and number of samples must match from one pass to the next. If the fixture slips in time or the first sample corresponds to a slightly different position, an otherwise repeatable disturbance appears to move through the record. Alignment of trials is thus a physical part of implementing the mathematical assumptions.
Take the simple sampled model \(x_{k+1}=a x_k+(1-a)u_k\), with \(0<a<1\) and \(x_0=0\). It can represent a position servo whose fast inner control loop has already been stabilised. The outer experiment changes its feedforward command between repetitions. A unit command produces a downstream effect starting at the next sample. Stack the commands as \((u_0,\ldots,u_{N-1})\) and the readings as \((y_1,\ldots,y_N)\). This ordering keeps the direct response of each command on the diagonal of a square matrix. Stacking \(y_0\) instead introduces a row carrying no information about any command.
For the first three readings, direct substitution gives \(x_1=(1-a)u_0\),
Repeated substitution produces a lower triangular matrix \(G\). In zero-based row and column indexing \(G_{kn}=(1-a)a^{k-n}\) for \(k\ge n\), and zero otherwise. Its columns are shifted, truncated impulse responses. Assemble the repeatable output disturbance into a vector \(d\). For the \(j\)th pass the measured output is \(\mathbf y_j=G\mathbf u_j+\mathbf d\).
Use virtual changes of the command to obtain the update direction
Let \(\mathbf r\) be the desired trajectory and define error \(\mathbf e_j=\mathbf r-\mathbf y_j\). Consider the scalar tracking objective \(J(\mathbf u)=\|\mathbf r-G\mathbf u-\mathbf d\|^2/2\). A perturbation \(\delta\mathbf u\) changes the measured output by \(G\delta\mathbf u\). Multiplying out the new squared error and retaining the linear term gives
The gradient in input coordinates is therefore \(-G^T\mathbf e\). Taking a step in the opposite direction gives the update
with a positive learning step \(\gamma\). Each input sample receives a weighted sum of subsequent output errors from the preceding trial. This apparent use of the future is ordinary causality when the two time indices are kept separate. At the moment the new command file is written, every sample from the previous pass is already known. No sensor can deliver the future errors of the pass currently being executed.
For a three-sample example let \(a=1/2\) and take the error record \((0,0,1)\). The last row of \(G\) is \((1/8,1/4,1/2)\). Consequently
An error in the final output calls for some correction to each earlier input because the plant remembers each command. Assigning the entire correction to the input with the same array index would neglect two of the available physical paths. An imperfect model can give poorly scaled weights, which is one reason to examine actual error after each update.
Derive a bound for every repeatable error direction
Substitute the new command into the output equation and subtract from the reference. The unknown disturbance cancels because it is the same vector in both trials. The result is \(\mathbf e_{j+1}=(I-\gamma GG^T)\mathbf e_j\). This gives a closed dynamical equation across trials. Its eigenvalues describe learning convergence; they are not the within-trial pole \(a\) of the servo.
Take a singular value decomposition \(G=U\Sigma V^T\). Expressing the output error in the orthogonal basis \(U\) shows that its \(i\)th component is multiplied by \(1-\gamma\sigma_i^2\). Thus all attainable directions contract monotonically in the Euclidean norm provided
Here \(G\) is nonsingular because its diagonal is nonzero. A more general stage with unobservable samples, missing actuators or pure delay longer than the chosen alignment can have zero singular values. Components of error outside its reachable output space then persist, however many trials are available. Inspecting the norm alone cannot reveal whether a plateau comes from this structural limit, measurement noise or a deliberately imposed actuator bound.
The slow directions have small singular values: a substantial command correction produces only a small output change. Inverting \(G\) directly would eliminate the deterministic error in one idealised iteration, but the same inversion magnifies sensor noise and can demand impractically oscillatory commands. Gradient learning spends many more trials on these directions while retaining a tunable update size. For a positive full-rank spectrum, balancing the two endpoint contraction magnitudes gives the ideal minimax step \(2/(\sigma_{\max}^2+\sigma_{\min}^2)\). Its usefulness still depends on how accurate the assumed plant is.
Read the stage trajectory and the trial history together

Interactive calculation · Learning motion
Change the physical and numerical inputs of the notebook model. Compare the updated curves and balance checks with the recorded notebook figures. Each plot uses the same equations and assumptions documented in that notebook; its readout names any analytical or reduced-model reference.
Interactive calculation · Learning errors
Change the physical and numerical inputs of the notebook model. Compare the updated curves and balance checks with the recorded notebook figures. Each plot uses the same equations and assumptions documented in that notebook; its readout names any analytical or reduced-model reference.
Use 48 commands, an inner-loop pole of 0.75 and a smooth reference combined with a smaller oscillation. Add a repeatable sinusoidal displacement to the output as a model of the fixture. The largest singular value is 0.9788 and the smallest is 0.1429. Choosing 90% of the upper admissible step gives \(\gamma=1.879\) and \(q=0.9616\). In the notebook the RMS tracking error falls from 0.56264 to about 0.00073 after thirty updates. The norm bound predicts a slower worst-case decline because the chosen reference has limited content along some slowly learned directions.
A change of step can produce alternating signs in a well-observed error direction while its magnitude still shrinks. For the strongest direction at the default step the multiplier is
Comparing signed errors at one time instant may look oscillatory even though the total norm decreases. Conversely, a deliberately excessive step can produce several initially improving records if the unstable direction is weakly represented in the original error. Evaluate a proposed step with the singular spectrum and with independent repeated trials.
Account for trial variation before interpreting a plateau
Let the disturbance differ between passes. Redoing the same subtraction now adds \(\mathbf d_j-\mathbf d_{j+1}\) to the nominal error update. A slowly changing load introduces drift in trial number. Independent sensor noise produces a new random input to every update. Learning too aggressively can write the noise of one trial into the command of the next. To distinguish this mechanism from an unlearnable repeatable error, run several identical command files without updating and compare the within-sample scatter across the repeats.
Other practical departures have different signatures. An amplitude-limited actuator clips the proposed command and breaks the linear update law. A stage with backlash may respond differently around reversal, even when two command records are close. A safely implemented laboratory algorithm can stop updating after the measured repeats reach their uncertainty floor and can retain a copy of the previous feasible input. These choices follow from the measured limitations of the particular motion and do not change the algebraic result for the unconstrained model.
Identify a lifted column from two physical trials
Suppose the stage dynamics are imperfectly known. Start with one baseline run and save its entire output record. On a second run change the third input sample by a small positive amount \(\delta\), leaving the other inputs fixed. If the reset and disturbance repeat, subtracting the baseline record gives \(\delta\) times the third column of \(G\). The first response increment appears at the following reading. For the assumed pole \(a=0.75\), a unit perturbation gives the sequence \(0.25,0.1875,0.140625\) at the first three affected readings. Their successive ratio estimates the pole without requiring the disturbance to be known. The absolute size of the first increment identifies the input gain. A departure from a constant ratio is evidence to inspect the one-pole model or the measurement repeatability.
When measurement resolution is poor, a perturbation can be too small to distinguish from baseline variability. Try perturbations of the same size and opposite signs on otherwise identical passes. Divide the difference in recorded outputs by \(2\delta\). A common offset cancels and an even quadratic dependence on input amplitude cancels as well. A large difference between the columns estimated at two perturbation sizes signals curvature or saturation. Repeat the calibration at an earlier and a later command index. Their overlapping samples should agree after an appropriate time shift if the closed-loop stage is time invariant during the move. This experiment tests the actual matrix used in the update, including timing and reset assumptions.
A final notebook cell forms the error-propagation matrix explicitly and asks OneSimulation for its symmetric eigenvalues when available locally. Their largest absolute value must agree with the worst error gain computed from singular values. The two computations expose a misplaced transpose or an incorrectly scaled learning step.
Exercises on what can be learned
1. With a memoryless sampled plant \(G=gI\), what step removes every deterministic output error in one update?
Work through the solution
The multiplier in each direction is \(1-\gamma g^2\). For \(g\ne0\), the choice \(\gamma=1/g^2\) sets it to zero. If \(g\) is overestimated, this choice takes too small a step and more trials are needed. If its magnitude is sufficiently underestimated, the learning gain can exceed the contraction bound.
2. Suppose the control engineer includes the initial reading \(y_0\) and drops the final one. Which output sample can no feedforward input in that move change?
Work through the solution
The initial reading precedes every available command. Its row in the lifted matrix is zero; the corresponding error direction has singular value zero. Choosing a larger gain leaves that component untouched. Align the output record with the first response sample or state explicitly that the initial mismatch belongs to the reset procedure.
3. Why can reducing the measured error in one pass make the next pass look worse when an external disturbance is freshly drawn?
Work through the solution
The update uses the previous measured error, which includes a random component. Its correction can point in a direction unrelated to the newly drawn disturbance. The term \(\mathbf d_j-\mathbf d_{j+1}\) survives the subtraction and the deterministic norm bound fails. Repeat the unmodified input several times to estimate a repeatable mean and the variability around it before changing the learning rate.
Compare the lifted calculation with experimental learning control
Bristow, Tharayil and Alleyne’s survey of iterative learning control relates time-domain learning laws to frequency-domain and robustness considerations. Identify the role of a stable within-trial feedback loop before applying a between-trial update to an actual positioning system.