Skip to content

Latest commit

 

History

4 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

LQR Optimal Control of Aircraft Pitch Dynamics

Continues from → Project 10: Pole Placement Control

Modern Control | Linear Quadratic Regulator | Algebraic Riccati Equation | Q/R Trade-Off Studies | MATLAB | Aerospace Engineering

This repository contains my eleventh independent control systems project — the first controller in the series that doesn't ask "can I hit these poles" but instead asks "what's the best possible controller given performance vs. control-effort trade-offs," applied to the same non-minimum-phase aircraft pitch plant carried through Projects 04–10.


Engineering Question

"Instead of manually specifying closed-loop pole locations (Project 10), can an optimal feedback gain be computed automatically by weighing state-tracking accuracy against actuator effort — and does this optimal controller actually outperform hand-placed poles?"

Answer: Yes. The LQR baseline controller (Q = I, R = 1) achieves zero steady-state error, satisfies both transient specs, and — compared directly against Project 10's pole placement — cuts settling time by 30.4% and overshoot by 81.9%, while using less peak actuator effort.


Overview

Project 10 proved that pole placement could satisfy both transient and steady-state specs where every classical controller failed — but the poles themselves were chosen by hand. Project 11 replaces that manual choice with an optimization:

  1. Verify controllability — confirm full-state feedback is still valid on the same plant
  2. Formulate the LQR cost function — balance state error (Q) against control effort (R)
  3. Solve the Algebraic Riccati Equation — MATLAB's lqr() function
  4. Apply reference scaling (N̄) — remove steady-state error without moving the poles
  5. Sweep Q and R — quantify the performance vs. control-effort trade-off directly
  6. Benchmark against pole placement — head-to-head comparison on the same plant

Stage 1 — Aircraft Pitch State-Space Model

Plant (Controllable Canonical Form), unchanged from Projects 09–10:

A = [0  1  0;  0  0  1;  -0.179  -0.987  -1.935]
B = [0; 0; 1]
C = [1.282  -1.282  0]
D = [0]
Check Result
Controllability rank 3 of 3 → ✅ Fully controllable
LQR applicable? ✅ Yes

Stage 2 — LQR Theory & Baseline Design

The optimal gain minimizes J = ∫(xᵀQx + uᵀRu)dt, solved via the Algebraic Riccati Equation AᵀP + PA − PBR⁻¹BᵀP + Q = 0, with K = R⁻¹BᵀP computed by lqr(A, B, Q, R).

Baseline configuration: Q = I₃ₓ₃, R = 1

K = lqr(A, B, Q, R);

Resulting gain: K = [0.8369 1.6697 0.9082]

Check Result
Closed-loop poles (Acl = A − BK) −0.6443 ± 0.4882j, −1.5546
Stability ✅ All poles in open LHP
Open-loop poles (for reference) −0.3336 ± 0.1730j, −1.2679

Unlike pole placement, the closed-loop poles here are a consequence of the Q/R weighting — not a direct designer input.


Stage 3 — Reference Scaling & Baseline Performance

Feedforward pre-compensation removes steady-state error without touching Acl:

N̄ = −[C(A − BK)⁻¹B]⁻¹ = 0.7924
u(t) = −Kx(t) + 0.7924·r(t)
Parameter Result
Rise Time 3.044 s
Settling Time 6.187 s
Overshoot 1.457%
Undershoot 11.228%
Steady-State Error ≈ 0

Specs: Ts < 10 s ✅ · OS < 10% ✅


Stage 4 — Effect of State Weighting (Q)

Weight on state x₁ increased by an order of magnitude while R = 1 held fixed:

Case Q Rise Time Settling Time Overshoot
1 diag(1,1,1) 3.044 s 6.187 s 1.457%
2 diag(10,1,1) 1.442 s 5.789 s 6.049%
3 diag(100,1,1) 0.742 s 3.829 s 11.068%

Increasing the state penalty forces faster convergence of x₁ — lower rise time, but at the cost of higher overshoot and control effort. Case 3 was ultimately eliminated as too aggressive.


Stage 5 — Effect of Control Weighting (R)

Q = I held fixed while R swept across two orders of magnitude:

R Gain K Poles Rise Time Settling Time Overshoot
0.1 [2.988, 5.475, 3.034] −0.833±0.515j, −3.303 2.511 s 5.279 s 0.711%
1.0 [0.837, 1.670, 0.908] −0.644±0.488j, −1.555 3.044 s 6.187 s 1.457%
10.0 [0.184, 0.410, 0.225] −0.430±0.308j, −1.300 4.809 s 9.060 s 1.191%

Heavily penalizing control action (R = 10) pulls the closed-loop poles back toward the open-loop positions — the controller becomes conservative almost by definition.


Stage 6 — Control-Effort Analysis

Configuration Peak |u| RMS u Total Energy
Q=I, R=1 0.7924 0.1714 0.8784
Q=diag(10,1,1), R=1 2.4706 0.2706 2.1673
Q=I, R=0.1 2.4706 0.2299 1.5559
Q=I, R=10 0.2834 0.1495 0.6704

Lower R or higher Q permits more aggressive control, buying speed at the cost of actuator demand — the central LQR trade-off made numerically explicit.


Stage 7 — Final Controller Selection

Selected: Q = I, R = 1 → K = [0.8369, 1.6697, 0.9082]

Although Q=I, R=0.1 shaved settling time to 5.280 s, it required 210% more peak control effort (2.4706 vs 0.7924). The baseline was retained as the balanced reference design, prioritizing actuator practicality over marginal speed gains.


Complete Controller Comparison — Projects 04–11

Controller Rise Time Settling Time Overshoot SSE Meets Specs?
Open Loop 7.56 s 13.93 s 0.23% Very large
P-only 3.42 s 13.23 s 18.15% 58%
PID 1.99 s 19.49 s 3.39% 0% ❌ (Ts)
Lead 1.77 s 13.31 s 28.61% Large
Lead–Lead 5.23 s 9.51 s 0.63% ≈100%
Lead–Lag 4.13 s 14.46 s 7.41% 51%
Optimizer 2.74 s 5.71 s 1.66% 74.5%
Pole Placement 2.27 s 8.89 s 8.06% ≈0%
LQR (Q=I, R=1) 3.045 s 6.188 s 1.46% 0%
LQR (Q=I, R=0.1) 2.511 s 5.280 s 0.71% 0%
LQR (Q=diag(10,1,1), R=1) 1.443 s 5.789 s 6.05% 0%

LQR vs. Pole Placement head-to-head: LQR reduces settling time by 30.4%, decreases overshoot by 81.9%, and reduces peak actuator effort by 33.4% — at the cost of a marginally slower rise time.


Key Engineering Conclusions

1. LQR replaces manual pole selection with an optimization: the designer specifies what matters (via Q and R), not where the poles go — the ARE solves for the poles that best serve that priority.

2. Q and R form a direct, tunable trade-off surface between response speed and actuator demand — there is no universally "best" choice, only the best choice for a given actuator's limits and mission requirements.

3. Compared directly against Project 10's hand-placed poles, the baseline LQR controller dominates on settling time, overshoot, and control effort simultaneously — evidence that optimization-based design can outperform manually chosen dynamics even without exhaustive tuning.

4. Peak control effort, not just time-domain performance, must be tracked explicitly — the Q=I, R=0.1 case shows a config that looks better on paper but demands 210% more actuator authority to get there.

5. LQR still respects the same underlying plant physics (the RHP zero, the coupled states) — it doesn't remove the plant's structural limitations, but it makes far more efficient use of the available control authority than either classical compensation or hand-tuned pole placement.


Aerospace Applications

  • Multi-objective flight-control design: Q and R let a designer assign explicit priority to different states (e.g., penalize pitch-rate excursions more than pitch-angle error) rather than tuning a single scalar gain.
  • Actuator-aware design: real elevators, thrusters, and RCS jets have finite authority — the control-effort analysis here (peak, RMS, energy) is exactly the kind of check needed before trusting a controller on hardware.
  • Autopilot and guidance law foundations: LQR is the baseline optimal-control building block behind more advanced techniques (LQG, MPC) used in aircraft autopilots and spacecraft attitude control.
  • Teknofest VLR Rocket: the Q/R weighting framework developed here is directly reusable for tuning the rocket's coupled attitude controller once full-state feedback is applied to the vehicle model.

Project Roadmap

✅ Project 01 — Mass-Spring-Damper Analysis
✅ Project 02 — DC Motor Modeling
✅ Project 03 — PID Speed Control
✅ Project 04 — Aircraft Pitch Control
✅ Project 05 — Root Locus Design
✅ Project 06 — Lead Compensator Investigation
✅ Project 07 — Lead–Lag Compensator Design
✅ Project 08 — Frequency Response Analysis
✅ Project 09 — State-Space Modeling
✅ Project 10 — Pole Placement Control
✅ Project 11 — LQR Optimal Control

→ Project 12 — Kalman Filter Design
→ Project 13 — UAV Attitude Control
→ Project 14 — Rocket Attitude Control
→ Project 15 — Satellite Attitude Control
→ Project 16 — Missile Guidance and Control
→ Project 17 — Integrated Flight Control System

Software Used

  • MATLAB R2024b
  • Control System Toolbox

Author

Zohaib Imtiaz Aerospace Engineering Student | Teknofest VLR Team — Flight Control


License

This project is released under the MIT License.


Project Cover

Project Cover


LQR Simulation

Simulation2_compressed.1.mp4