Hello! Welcome back to our course on multivariable control.
In the last lesson, we designed an integral-augmented controller to provide robustness against constant disturbances. We saw how to construct an augmented system and use methods like pole placement or LQR to find the feedback gains K_p and K_i.
Today, we'll put that theory into practice. The goal is to simulate and compare the tracking and disturbance rejection performance of different controller designs. We will set up a head-to-head comparison between a standard state-feedback controller and our new integral-augmented controller. This will clearly demonstrate the practical trade-offs and show why integral action is so valuable.
We will evaluate the controllers on two key tasks, which are visualized in the plots below:
- Reference Tracking: How well the system follows a command or setpoint.
- Disturbance Rejection: How well the system maintains its setpoint in the face of external upsets.

1. The Controllers Under Comparison
To make a fair comparison, we need two well-designed controllers.
Controller 1: State-Feedback Regulator with Pre-compensation
The simplest state-feedback law is a regulator, u = -Kx. As a regulator, its job is to drive the system states to zero. To make it track a non-zero reference r, we need to modify it. A common approach is to introduce a pre-compensation gain, N_bar, so the control law becomes:
The gain K is designed using LQR or pole placement to stabilize the system and give good transient performance. The new gain N_bar is a scaling factor calculated to ensure that the output y equals the reference r at steady-state.
The "Aircraft Pitch" resource provides an excellent explanation of this method.
Aircraft Pitch: State-Space Methods for Controller Design
This reading from the University of Michigan's CTMS site explains why a precompensator is needed for LQR regulators and how to calculate it to achieve zero steady-state tracking error.
Please read the section titled 'Adding precompensation.' Focus on understanding why a simple regulator has steady-state error and how the scaling factor N_bar is introduced to correct it. Don't worry about the rscale.m function; the key is the concept.
The crucial takeaway is that N_bar is calculated based on the system model (A, B, C, D) and the gain K. Its purpose is to 'invert' the steady-state gain of the closed-loop system. This works well for reference tracking, but as we'll see, it's not effective against unforeseen disturbances.
Controller 2: Integral-Augmented State-Feedback
This is the controller we designed in the previous lesson.

The control law is:
This controller was designed by finding a single gain K_a = [K_p, K_i] for the augmented system. By its very structure, this controller works to drive the error e = r - y to zero, so no separate pre-compensator is needed.
2. Simulation Showdown 1: Reference Tracking
Let's first compare how each controller responds to a change in the desired setpoint.
The Test:
- Start the system at rest (zero initial conditions).
- Apply a step input to the reference, e.g.,
r = 1. - Keep the external disturbance
dat zero. - Simulate and plot the output
y(t)and the control effortu(t).
What to Compare:
- Transient Response: Rise time, settling time, and overshoot. These are tuned by your pole placement or LQR choices.
- Steady-State Error: Does
y(t)actually settle atr=1? This is the key point of comparison. - Control Effort: How much input
u(t)is required? Is it within realistic limits?
The following video provides a detailed walkthrough of building a Simulink model for an integral-augmented LQR controller, which is exactly our Controller 2. You can use this as a template for setting up your own simulations.
Control of State-Space Models in Simulink By Using Linear Quadratic Regulator - Control Systems
This video by Aleksandar Haber provides a step-by-step guide to building a Simulink model for an integral LQR controller and simulating its tracking response.
Please watch these segments to see how a simulation is constructed and run: Simulink Model Build (9:49 - 21:22): Observe how the state-space model, the state feedback (Kx), and the integral feedback (Ki) are implemented using standard Simulink blocks. Simulation and Analysis (21:22 - 22:01): See how the simulation is run and the results are interpreted from the scope.
Expected Results:
- Controller 1 (Regulator with
N_bar): If your system model is accurate, this controller should exhibit zero steady-state error. TheN_barfactor correctly scales the input to achieve this. - Controller 2 (Integral): This controller will also exhibit zero steady-state error. The integrator ensures that any persistent error is eliminated. It is generally more robust to small modeling errors than the
N_barapproach.
3. Simulation Showdown 2: Disturbance Rejection
Now for the more interesting test. Let's see how the controllers handle an unexpected external disturbance.
The Test:
- Start the system at a steady setpoint, e.g.,
r = 1. (Let it settle first, or start withr=0). - Apply a step disturbance to the input, e.g.,
d = 0.5. - Simulate and plot the output
y(t)and the control effortu(t).
What to Compare:
- Peak Deviation: How far does the disturbance push the output away from the setpoint?
- Recovery: Does the system return to the original setpoint? If so, how quickly?
- Steady-State Error: This is the most important metric here. Is there a persistent error after the disturbance hits?
Expected Results:
- Controller 1 (Regulator with
N_bar): The disturbance will cause an initial deviation. Since the controller has no mechanism to account for this unknown input, the output will not return to the original setpoint. There will be a persistent steady-state error. TheN_bargain was calculated for reference tracking, not for disturbance rejection. - Controller 2 (Integral): The disturbance will also cause an initial deviation. However, this deviation creates an error (
r-y). The integrator will accumulate this error, changing the control inputuuntil the error is forced back to zero. The system will return to the original setpoint, exhibiting zero steady-state error.
Test your understanding!
Imagine you've implemented Controller 1 (regulator with N_bar) for your rotary pendulum to hold the arm at 90 degrees. The system works perfectly. Then, a constant friction force (a disturbance) that you didn't account for in your model appears. What do you expect will happen to the arm's final position? Will it be at 90 degrees, more than 90, or less than 90?
Show answer
The arm will likely settle at a position other than 90 degrees. The precompensator N_bar was calculated based on the assumed model (without the extra friction). The constant friction disturbance will introduce a steady-state error that the controller cannot correct because it lacks integral action. The final position will be offset from the desired 90 degrees.
4. Application to Your Rotary Inverted Pendulum Project
The concepts we've discussed are not just theoretical exercises; they are the core of practical control design. The documentation for your pendulum project explicitly guides you through this exact comparison process.
CACSD Practical Session Rotary Inverted Pendulum
The practical session guide for the rotary inverted pendulum requires you to perform these exact simulations and comparisons to validate your design.
Please review the following sections of this document: Section 2.2, 'The Controller': Note the discussion on how to apply a setpoint xd and evaluate performance via step response. Section 4, 'Report' item 2(c): This explicitly asks you to simulate a setpoint change and discuss the results, including control actions. Section 4, 'Report' item 4(c): This asks you to perform disturbance rejection tests on the real hardware. Simulating this first is a crucial step to predict behavior.
This guide also encourages you to build more realistic simulations by including effects like actuator saturation, sensor noise, and filtering (Section 4, item 3). Comparing your ideal simulation with a more realistic one is another layer of the "compare performance" outcome and is excellent engineering practice before moving to hardware.
Conclusion
Today we've seen through simulation why integral control is a cornerstone of robust control design. While a simple state-feedback regulator with pre-compensation can track a reference under ideal conditions, it fails to reject unknown constant disturbances. The integral-augmented controller excels at both tasks, making it a far more reliable choice for real-world applications where unexpected forces and model inaccuracies are inevitable.
Key Takeaways:
- Reference Tracking: Both a regulator with a pre-compensator (
N_bar) and an integral controller can achieve zero steady-state error for step inputs, but the integral controller is more robust to model errors. - Disturbance Rejection: Only the integral controller can reject constant, unmeasured disturbances and return the system to its setpoint with zero steady-state error.
- Simulation is Key: Simulating both tracking and disturbance rejection scenarios is essential for comparing and validating controller designs before implementation.
Preview of the Next Lesson:
We have now established a solid foundation for designing and analyzing SISO state-space controllers. In the next module, we will begin our formal journey into multivariable (MIMO) systems. Our first step will be to learn how to formulate state-space equations for systems with multiple inputs and multiple outputs, which will open the door to controlling more complex systems like the full rotary inverted pendulum (both arm and pendulum angle).