Adaptive Control MRAC Simple Simulator All tools
Interactive simulator

Adaptive Control MRAC Simple Simulator

Watch the plant output y(t) chase the reference model y_m(t), the tracking error e shrink, and the adaptive gains θ(t) converge in real time. A larger adaptation gain γ converges faster; too large and it diverges.

Parameters
Presets
Plant time constant τ_p
s

Response speed of the controlled plant.

Reference model time constant τ_m
s

Desired reference-model speed.

Adaptation gain γ
-

Strength of parameter update. Larger means faster convergence; too large diverges.

Disturbance level
%

Load variation or unmodeled disturbance.

Live values
0.0
time t [s]
0.00
plant y
0.00
model y_m
0.000
error e
0.00 / 0.00
θ_r / θ_y
Adapting…
Output tracking y(t) vs reference model y_m(t)
plant y(t) reference model y_m(t) command r(t)
Tracking error e = y − y_m
Adaptive gains θ_r(t), θ_y(t)
θ_r (feedforward) θ_y (feedback) ideal θ*
Results
Steady tracking error (RMS)
Adaptation settling time
Oscillation tendency
Adaptation progress
Theory & Key Formulas

A first-order plant is made to follow a first-order reference model:

$$\dot y=-\tfrac{1}{\tau_p}y+\tfrac{1}{\tau_p}u+d,\qquad \dot y_m=-\tfrac{1}{\tau_m}y_m+\tfrac{1}{\tau_m}r$$

Control law and the MIT rule (adaptation law):

$$u=\theta_r\,r-\theta_y\,y,\qquad e=y-y_m,\qquad \dot\theta_r=-\gamma\,e\,r,\quad \dot\theta_y=\gamma\,e\,y$$

Ideal matching gains (where the gain curves converge):

$$\theta_r^{*}=\frac{\tau_p}{\tau_m},\qquad \theta_y^{*}=\frac{\tau_p}{\tau_m}-1$$

A larger $\gamma$ speeds up convergence, but if it is too large $\theta$ swings wildly and can run away. With disturbance, $e$ never reaches exactly 0 and the gains keep drifting (parameter drift). Check: $\tau_p=2.5,\ \tau_m=1.2$ → converges to $\theta_r^{*}\approx2.08,\ \theta_y^{*}\approx1.08$.

What is MRAC (Model Reference Adaptive Control)

MRAC (Model Reference Adaptive Control) is a classic adaptive-control method that automatically tunes the controller gains online so the output matches a chosen reference-model response, even when the plant's exact parameters are unknown or change during operation.

In this simulator a first-order plant $\dot y=-y/\tau_p+u/\tau_p+d$ is made to follow a desired first-order reference model $\dot y_m=-y_m/\tau_m+r/\tau_m$. The controller has a feedforward gain $\theta_r$ and a feedback gain $\theta_y$, and it updates them with the MIT rule using the tracking error $e=y-y_m$.

How to read this simulator

Output-tracking chart: the blue line is the plant output y(t) and the dashed orange line is the reference-model output y_m(t). At first the blue line is off; as time passes they overlap. When they overlap, adaptation is complete.

Tracking-error chart: the history of e=y−y_m. The error jumps when the command switches, but as adaptation proceeds the peaks shrink and it sticks to the zero line. If the error never shrinks, γ is too small or too large.

Adaptive-gain chart: θ_r (green) and θ_y (red) move toward the ideal matching gains θ* shown as white dashed lines. Flat gains mean adaptation has settled; gains that keep thrashing mean γ is too large.

Learn MRAC reference-model tracking by dialogue

🙋
In the animation the blue plant line gradually overlaps the orange reference-model line. What is actually happening?
🎓
Roughly speaking, the controller notices its gains are still wrong and fixes them on the fly. It watches the tracking error e=y−y_m and nudges the gains in the opposite direction of the error. That's the MIT rule, dθ/dt=−γ e φ. The moment they overlap, adaptation is done.
🙋
I see. So if I make the adaptation gain γ larger, they overlap faster — that's good, right?
🎓
Up to a point. Press the "Fast convergence" preset and γ is large enough to kill the error in a few seconds. But press "Oscillating." With an extreme γ a single update overshoots, the gains θ thrash violently, and with disturbance the error keeps swinging. It's like a car snaking down the road because you steer too hard.
🙋
On the gain chart the green and red lines approach the white dashed lines. What are those dashed lines?
🎓
Those are the ideal matching gains θ*. For a first-order system you can compute them: θ_r*=τ_p/τ_m and θ_y*=τ_p/τ_m−1. MRAC reaches them without knowing them, using only the error. Landing exactly on the dashed lines means it found the correct gains on its own — which matters on real hardware where the plant time constant is unknown.
🙋
When I raise the disturbance slider, the lines keep wobbling a bit even after they overlap. Is that a problem?
🎓
Good catch. With disturbance the error never reaches exactly 0, so MRAC thinks "there's still error" and keeps moving the gains. This is called parameter drift; left alone the gains can slowly run away. In practice we add a dead-zone that stops adaptation when the error is small, or σ/e-modification to keep the gains bounded.
🙋
So once I pick γ here, can I use it directly on real hardware?
🎓
Treat this as a first-pass study. This simplified model is only first-order plant plus first-order reference model. Real plants have dead time and higher-order resonant modes, so the raw MIT rule easily goes unstable. For final decisions, check standards, measured data, detailed analysis, and vendor limits, and combine a Lyapunov-based adaptation law with input limits.

Real-world applications

Servo / motion control: multi-axis NC machine and robot-arm servos whose load inertia changes during operation, where fixed gains degrade tracking.

Aerospace: flight control of aircraft and missiles whose mass changes greatly as fuel burns (one of the historical birthplaces of MRAC).

Process / construction machinery: chemical processes whose dynamics shift with temperature or material, and hydraulic-actuator load-variation compensation.

Common misconceptions and cautions

"Bigger γ is always better" is wrong: γ is a trade-off between convergence speed and stability. Use the Oscillating preset to see how an excessive γ makes the gains swing wildly and run away.

"e=0 means the gains are correct" is not guaranteed: without persistent excitation (PE), the gains may not converge to the ideal values even when the error is 0. The command must keep "varying" enough.

Disturbance and unmodeled dynamics cause drift: the raw MIT rule is fragile to disturbance, so robust modifications (σ-modification, dead-zone, normalization) are essential in practice.

FAQ

First watch whether the tracking error e=y−y_m approaches 0 over time. In the animation, when the plant output y(t) (blue) overlaps the reference-model output y_m(t) (dashed orange), adaptation is proceeding. Next check whether the adaptive gains θ_r, θ_y settle to horizontal lines. The instant the gains flatten and the error vanishes is "adaptation complete".
The MIT rule dθ/dt=−γ e φ updates the gains faster the larger γ is. If γ is excessive, each step moves the gains too far, overshooting before the error sign reverses, so the gains oscillate and can run away. The "Oscillating" preset shows θ(t) thrashing while the error keeps swinging. In practice raise γ from a small value and keep it within the range where the error decreases monotonically.
For a first-order plant the ideal matching gains are θ_r*=τ_p/τ_m and θ_y*=τ_p/τ_m−1. The faster you want the reference model (smaller τ_m), the larger the required feedforward θ_r and feedback θ_y. The gain curves in the animation converge to these ideal values (dashed lines). If the ratio is too large the control input saturates easily, so consider input limits on real hardware.
With disturbance the tracking error never reaches exactly 0, and the gains keep wobbling slightly (parameter drift), because MRAC reads the disturbance as error and keeps moving the gains. Remedies include a dead-zone that stops adaptation where the error is small, and σ/e-modification to prevent gain runaway. The disturbance slider lets you see the size of this wobble.
This tool is the most basic MRAC: first-order plant plus first-order reference model. On real hardware with higher-order systems, dead time, non-minimum-phase behavior, or large unmodeled dynamics, the raw MIT rule can destabilize. Implementations combine a Lyapunov-based adaptation law, normalization, robust modifications (σ/e/dead-zone), and input limits. Confirm final decisions with standards, measured data, detailed analysis, and vendor conditions.

How to Use

  1. Set the plant time constant τ_p (s) and the reference-model time constant τ_m (s). The effect of adaptation is clearest when a slow plant (large τ_p) follows a fast model (small τ_m)
  2. Set the adaptation gain γ and, while the animation plays, watch how fast the blue plant line overlaps the orange reference-model line and how the gain curves converge to the ideal values (dashed lines)
  3. Compare behavior with the "Fast convergence", "Slow convergence", and "Oscillating" presets, and raise the disturbance slider to see the post-adaptation wobble (parameter drift)

Worked Example

To make a servo motor (plant time constant τ_p=2.5 s) follow a faster reference model (τ_m=1.2 s), the ideal matching gains are θ_r*=τ_p/τ_m=2.08 and θ_y*=τ_p/τ_m−1=1.08. Run with γ=3 and MRAC, without knowing these values, converges from the error alone to θ_r→2.08 and θ_y→1.08 within a few seconds, and the plant output nearly overlaps the reference model. With γ=0.2 convergence is slow and error remains; with a very large γ each update is excessive and the gains swing wildly. The idea is applied to axis compensation of multi-axis NC machines and to flight control of vehicles whose mass changes as fuel burns.

Practical Notes