Flow Lab

Syllabus / Module 16: Capstone Builds

Lesson 16.2

Capstone: 6-DOF Flight Simulator with Autopilot

Build a flight model from aerodynamic coefficients, integrate the 6-DOF equations, render an attitude display, and add PID/LQR altitude and heading hold.

Written byClaude Sonnet

🌊
Why this matters for simulation: The skeleton of a real flight simulator.

By the end of this lesson you can…

  • State exactly what the simulator contains (states, coefficients, wind, limits) and which numbers are assumptions beyond Modules 12 and 13.
  • Trim the 12.4 aircraft at 50 m/s and show that small nonlinear disturbances reproduce the 12.5 and 12.6 modes while large ones do not.
  • Build the autopilot from Module 13: discrete LQR pitch, speed and altitude hold, and roll and heading hold with yaw damping, read as PID gains.
  • Add actuator lag, rate and position limits, and an altimeter with noise and an observer, and say what each does to the loop.
  • Run an altitude step, a turn, a gust and two failures, and report settling, overshoot, peak elevator and maximum angle of attack and bank.
  • Name three autopilot failures (windup, nonlinearity far from trim, unmodelled actuator lag) with the lab's numbers, and what a real tool adds.
On this page
·
  1. Exactly what is simulated
  2. Integration: quaternions and RK4
  3. Trim, and the linearisation check
  4. The autopilot
  5. Actuators and sensors
  6. The lab
  7. Scenarios, with numbers
  8. What the autopilot gets wrong
  9. Computing it
  10. Concept checks
  11. Problems
  12. What comes next
  13. Key Takeaways

Module 12 built an aircraft and Module 13 the tools for flying it. This capstone puts them together: the nonlinear model of 12.4 6-DOF Aircraft Equations of Motion in a loop with an autopilot that holds altitude and heading, flown through a gust, a turn and a failure. A controller designed on a linear model is a claim about a small neighbourhood of trim, and the simulator tests it, so we spend as much time on what breaks as on what works.

▶ Video The twelve states and the loop around them: trim, the linear check against the modes, the LQR pitch and bank loops, the actuator and sensor limits, and the four scenarios with the autopilot's failurescaptions only
Transcript
  1. Capstone sixteen point two is a flight simulator. It is the nonlinear light aircraft of lesson 12.4, thirteen states: position, body velocity, a quaternion for attitude and the body rates, with no small angle approximation. The coefficients are those of 12.4, unchanged, integrated by Runge-Kutta 4 at 0.02 seconds, the controller's 50 hertz period. Three things are new, and all three are assumptions: a vertical wind, actuators with a lag of 0.05 seconds and a rate limit of 60 degrees per second, and an altimeter with 1 metre of noise. A 60 second flight runs in 10 to 17 milliseconds.
  2. Trim comes first. At 50 metres per second the 12.4 Newton solve gives an angle of attack of 2.6606 degrees, an elevator of minus 2.7452 degrees and a throttle of 0.3880. Linearise there and the phugoid has a period of 27.98 seconds. Do the nonlinear aircraft follow the linear model? Kick the pitch rate and compare altitudes. At 0.02 radians per second the gap is 0.3 percent. At 0.2 it is 2.8 percent. At 0.5 it is 7.1 percent. The linear modes describe small disturbances well and degrade smoothly as they grow.
  3. The autopilot is Module 13. Both channels are a discrete LQR designed once at 50 hertz. The altitude command goes through a rate limiter into the longitudinal LQR, whose elevator row reads as a PID: 2.20 radians of elevator per radian of pitch error, a pitch rate gain of 0.817 seconds, 0.0233 radians per metre of altitude error, and an integral gain of 0.004102 that removes steady error. The heading error becomes a bank command, limited to 25 degrees, and the lateral LQR drives aileron and rudder. Its rudder row has minus 1.0355 on yaw rate: the yaw damper falls out of the optimum.
  4. First test: an altitude step of plus 100 metres at 5 seconds. The command goes through the 5 metres per second rate limiter, and the aircraft follows with an overshoot of 9.727 metres, then settles to within 2 metres at 30.62 seconds. The elevator peaks at only 3.994 degrees and the angle of attack reaches 4.429 degrees, so the step never asks for anything extreme. This is the loop working inside the region it was designed for.
  5. Second test: a heading change of plus 90 degrees with the bank limited to 25 degrees. Bank peaks at 25.036 degrees, and heading is within 1 degree 23.62 seconds after the command. A steady 25 degree turn goes at 5.242 degrees per second, so 90 degrees alone would take 17.17 seconds; the rest is rolling in and closing the last degrees. Altitude holds to 1.631 metres. The yaw damper and the turn feedforward keep it coordinated.
  6. Third, a vertical gust of 5 metres per second, one cosine bump lasting 4 seconds. With the autopilot the altitude deviation is 8.554 metres and it recovers. With the autopilot off the gust excites the phugoid and the deviation reaches 15.324 metres. Now the engine fails at 5 seconds. Altitude hold pulls back to trade speed for height. Speed falls to 26.23 metres per second, and at 35.28 seconds the lift reaches its cap. After that the simulation is wrong: a real aircraft stalls well before that, and this one cannot. The numbers past that point are not a prediction.
  7. Now the failures. First, windup. Climb 100 metres with the elevator limited to 3.5 degrees. With conditional integration, which freezes the integrator while the command is past the limit, the overshoot is 5.063 metres. Without it the integrator keeps charging against the stop, and the overshoot is 62.660 metres. The gains are the same in both runs. A linear design is being asked for more than its limits allow.
  8. Three more failures. Far from trim: in the heading change the altitude error is 1.631 metres at 25 degrees of bank and 10.671 metres at 60. My reading, not a separate test, is that the linear model has no loss of lift in a steep turn. Unmodelled actuator lag: the bank peak is 25.036 degrees at a time constant of 0.05 seconds and 31.305 degrees at 1.5 seconds. And noise: with a 1 metre altimeter, the elevator's rms movement is 0.042 degrees with the observer and 0.644 degrees without it, fifteen times more.
  9. What this simulator does not do matters as much. There is no stall model: lift is only capped at 1.4. There is no density change, no ground, no turbulence beyond one gust, no flexibility, fuel or engine dynamics, and no sensor delay. The actuator and sensor numbers are assumptions, and the aerodynamic coefficients are typical and from memory. A real flight-dynamics tool adds stall and post-stall tables, an atmosphere, ground effect, engine and propeller models, turbulence, sensor delay and gain scheduling, and its coefficients come from flight test.
  10. That closes the physics arc: derivatives and vectors, the flow equations and a solver, then an aircraft and a controller flying inside it. The simulator gave honest answers where the linear design holds, and showed where it breaks. The next row in the course is lesson 9.1, What Is a PDE, on conservation laws and classification. It is not yet written.

Exactly what is simulated

The vehicle is the 12.4 light aircraft: m=1100m = 1100 kg, wing area 16.516.5 m2^2, span 1111 m, the inertia matrix of 12.3 Rigid-Body Dynamics & Rotations, and the coefficients of 12.1 Airfoils, Circulation & Lift to 12.4 6-DOF Aircraft Equations of Motion unchanged: CLα=5.313C_{L\alpha} = 5.313, CLδe=0.43C_{L\delta_e} = 0.43, the drag polar with CD0=0.027C_{D0} = 0.027 and e=0.8e = 0.8, the moment and side-force derivatives, and a maximum thrust of 24002400 N. 12.4 said those derivatives are typical of a Cessna-172 class aircraft, quoted from memory; every number below inherits that. This is a plausible aircraft, not a particular one.

The state is thirteen numbers: position, body velocity, a unit quaternion and body rates. All six degrees of freedom move, with no small-angle approximation. Three things are new, all assumptions of this lesson:

  • Wind. A vertical world wind wz(t)w_z(t) changes the air-relative velocity used by the aerodynamics, va=v−RT(0,0,wz)\mathbf v_a = \mathbf v - R^{\mathsf T}(0,0,w_z). With wz=0w_z = 0 it matches 12.4’s derivative exactly (difference 00 on a tumbling test state).
  • Actuators. Each command passes a position clamp, then a first-order lag with time constant τ=0.05\tau = 0.05 s and a rate limit of 60∘60^\circ/s. Limits: elevator ±25∘\pm 25^\circ, aileron ±20∘\pm 20^\circ, rudder ±25∘\pm 25^\circ. The throttle has a 11 s lag. These numbers are chosen, not measured.
  • Sensors. The altimeter has white noise (default σ=1\sigma = 1 m, off until switched on). Everything else is read perfectly.

Not simulated: stall (lift is capped at CL=1.4C_L = 1.4, a ceiling and not stall physics), density change, the ground, turbulence beyond one gust, flexibility, fuel, engine dynamics, sensor delay and shear. As in 12.4 there is no adverse yaw, CYpC_{Y_p} or CYrC_{Y_r}.

Integration: quaternions and RK4

Attitude is a quaternion because Euler angles are singular at θ=±90∘\theta = \pm 90^\circ. Its rate is q˙=12q⊗(0,ω)\dot{\mathbf q} = \tfrac12 \mathbf q \otimes (0, \boldsymbol\omega), renormalised after every step so rounding does not shrink the rotation; Euler angles are computed only for readouts and the heading loop.

The step is the classical RK4 of 4.3 Runge–Kutta Methods & Butcher Tableaux at h=0.02h = 0.02 s with controls held constant across it. That is the controller’s 5050 Hz period, so a zero-order hold is what the plant really sees, and hh is well inside RK4’s stability limit (Problem 3). A 60 s scenario takes 10 to 17 ms in Node, so the lab runs the nonlinear model live.

Trim, and the linearisation check

Trim at 5050 m/s and 10001000 m is Newton’s method on the 12.4 derivative: α=θ=2.6606∘\alpha = \theta = 2.6606^\circ, elevator −2.7452∘-2.7452^\circ, throttle 0.38800.3880. Linearising there (12.5 Trim, Linearization & Longitudinal Modes, 12.6 Lateral-Directional Modes) gives those lessons’ modes:

  • short period −2.6647±3.6964i-2.6647 \pm 3.6964i and phugoid −0.0126±0.2246i-0.0126 \pm 0.2246i (period 27.9827.98 s);
  • roll subsidence −9.379-9.379, Dutch roll −0.4832±2.2898i-0.4832 \pm 2.2898i and spiral −0.00678-0.00678.

Does the nonlinear aircraft follow that linear model? Autopilot off, from trim, a pitch-rate kick q0q_0, 6060 s:

  • q0=0.02q_0 = 0.02 rad/s: the altitude peaks at 0.51710.5171 m, the largest gap between nonlinear and linear altitude is 0.001410.00141 m (about 0.3%0.3\%), and the phugoid period is 27.9827.98 s.
  • q0=0.2q_0 = 0.2 rad/s: peak 5.09785.0978 m, gap 0.14120.1412 m (2.8%2.8\%), period 27.9827.98 s, the same as the 12.4 lab.
  • q0=0.5q_0 = 0.5 rad/s: peak 12.43712.437 m, gap 0.8840.884 m (7.1%7.1\%).

A 2∘2^\circ sideslip in the lateral block gives a yaw-rate peak of 0.0558850.055885 rad/s and a gap of 6.28×10−56.28\times10^{-5}. The linear modes describe small disturbances well and degrade smoothly as they grow.

The autopilot

Both channels are the discrete LQR of 13.7 LQR & State Estimation, designed once at 5050 Hz: an exact zero-order-hold discretisation by matrix exponential, and a Riccati solution by doubling (14 and 10 iterations, residual below 10−1210^{-12}). Nothing heavy runs per frame.

Longitudinal. The state is (u,w,q,θ,eh,z)(u, w, q, \theta, e_h, z): the 12.5 states, the altitude error ehe_h and its integral zz. The inputs are elevator and throttle (thrust per unit throttle is Tmax⁡/m=2.18T_{\max}/m = 2.18 m/s2^2). Weights: Qu=0.04Q_u = 0.04, Qw=0.0625Q_w = 0.0625, Qq=Qθ=44Q_q = Q_\theta = 44, Qeh=0.01Q_{e_h} = 0.01, Qz=0.001Q_z = 0.001, Rδe≈39.8R_{\delta_e} \approx 39.8, Rthr=11R_{\text{thr}} = 11, chosen by the weight rule of the LQR lesson. The elevator row, in radians, is

Ke=[−0.0051,  0.0148,  −0.8168,  −2.2041,  −0.02325,  −0.004102].K_e = [-0.0051,\; 0.0148,\; -0.8168,\; -2.2041,\; -0.02325,\; -0.004102] .

Read it as a PID: 2.202.20 rad of elevator per rad of pitch error, a pitch-rate (derivative) gain of 0.8170.817 s, 0.02330.0233 rad per metre (1.33∘1.33^\circ per metre) of altitude error, and an integral term of 0.0041020.004102 rad per metre-second (0.235∘0.235^\circ per metre-second) that removes steady error. The gains on uu and ww are the extra feedback a three-term PID lacks. The throttle row is an autothrottle that mainly reacts to speed. The closed-loop roots, mapped back to the ss-plane, are −19.95-19.95, −3.368-3.368, −0.5970±0.4400i-0.5970 \pm 0.4400i, −0.3017-0.3017 and −0.1390-0.1390: the lightly damped phugoid (ζ=0.056\zeta = 0.056) is replaced by a pair with ζ=0.80\zeta = 0.80, and no oscillatory short-period pair remains. The altitude command goes through a 55 m/s rate limiter so a step never asks for an impossible pitch.

Lateral. The state is (v,p,r,ϕ)(v, p, r, \phi) with aileron and rudder as inputs. The gains act on the error from the steady coordinated turn at the commanded bank, with a feedforward from the linear model: steady r=0.1930 ϕr = 0.1930\,\phi (against g/V=0.1962g/V = 0.1962) and a little rudder. So the damper does not fight the turn, 12.6’s flaw in the plain yaw damper. Weights: Qv=0.11Q_v = 0.11, Qp=11Q_p = 11, Qr=44Q_r = 44, Qϕ=100Q_\phi = 100, Ra=11R_a = 11, Rr=44R_r = 44. The rudder row has −1.0355-1.0355 on rr: the yaw damper as a by-product of the optimum. Closed-loop roots: −33.13-33.13, −3.308±1.711i-3.308 \pm 1.711i (ζ=0.888\zeta = 0.888), −2.929-2.929.

Heading hold is an outer proportional loop, ϕc=clamp(1.5 (ψc−ψ), ±25∘)\phi_c = \mathrm{clamp}\big(1.5\,(\psi_c - \psi),\, \pm 25^\circ\big). Pitch hold is the θ\theta term, altitude hold the ehe_h and zz terms. Anti-windup is conditional integration: zz stops accumulating while the elevator command is past its limit and the error would push it further. The lab can switch it off.

Actuators and sensors

The LQR plant has no actuator: the design assumes the elevator goes where it is told. The lag, rate limit and stop above are what the real loop adds, and that unmodelled lag causes the third failure below.

The altimeter reading hm=h+σnh_m = h + \sigma n would feed ehe_h directly, and the gain on ehe_h turns white noise into elevator motion. The lab’s filter is h^˙=h˙kin+L(hm−h^)\dot{\hat h} = \dot h_{\text{kin}} + L(h_m - \hat h). The rate h˙kin\dot h_{\text{kin}} comes from the air-relative velocity and attitude (an assumption: what an air-data and attitude system would supply), so a gust is an error in the filter’s model that the correction term must remove. L=1L = 1 s−1^{-1} by default: a 11 s time constant, the first-order case of the observer of 13.7 LQR & State Estimation.

The lab

◆ Interactive The nonlinear aircraft under autopilot: pick a scenario, watch altitude, speed, pitch, bank, heading and the control surfaces, and read the settling, overshoot, peak elevator and maximum angle of attack and bank

Loading simulation…

The attitude indicator and heads-up display show the state as a pilot sees it. With the autopilot off, three pilot sliders command elevator, aileron and rudder directly: the manual flying of 12.4 on a plant with limits. The weight sliders redesign the LQR when you let go, so you can watch a more aggressive design hit its limits earlier.

Scenarios, with numbers

Every figure is from the lab at h=0.02h = 0.02 s with the default weights, anti-windup on, no noise and τ=0.05\tau = 0.05 s unless a change is stated. An independent NumPy implementation of the same equations agrees to better than 10−910^{-9} relative.

Altitude step, +100+100 m at t=5t = 5 s. Overshoot 9.7279.727 m (9.7%9.7\%), settling to within 22 m at 30.6230.62 s, final error 0.0060.006 m. Peak elevator 3.994∘3.994^\circ, α\alpha up to 4.429∘4.429^\circ, speed down to 42.3942.39 m/s as the climb costs speed, throttle up to 0.8470.847. Weight log⁡10qh=−1\log_{10}q_h = -1 gives overshoot 6.4416.441 m and a slower 36.0236.02 s settle; −3-3 gives 10.47910.479 m and 29.4029.40 s.

Heading change, +90∘+90^\circ at t=5t = 5 s, bank limit 25∘25^\circ. Bank peaks at 25.036∘25.036^\circ; heading is within 1∘1^\circ 23.6223.62 s after the command and ends at 89.9999∘89.9999^\circ. A steady 25∘25^\circ turn goes at gtan⁡ϕ/V=5.242∘g\tan\phi/V = 5.242^\circ/s, so 90∘90^\circ takes 17.1717.17 s plus roll-in and approach. Altitude holds to 1.6311.631 m; aileron peaks at 18.099∘18.099^\circ and rudder at 3.223∘3.223^\circ.

Gust, 55 m/s vertical, one cosine bump of 44 s from t=5t = 5 s (an assumed shape). With the autopilot: altitude deviation 8.5548.554 m, α\alpha to 3.056∘3.056^\circ, speed to 51.5451.54 m/s, recovered by the end. Without it the gust excites the phugoid: 15.32415.324 m peak and still 7.7517.751 m off at 4040 s. A 1010 m/s gust gives 17.11017.110 m with the autopilot, 30.49630.496 m without, and α=8.455∘\alpha = 8.455^\circ.

Engine out at t=5t = 5 s. Altitude hold pulls back to trade speed for height. Speed falls to 26.2326.23 m/s, the elevator command is past its 25∘25^\circ limit for 18.4418.44 s, the altitude error reaches 55 m 29.5429.54 s after the failure, and at t=35.28t = 35.28 s lift hits the CL=1.4C_L = 1.4 cap, at α=13.8∘\alpha = 13.8^\circ. After that the simulation is wrong: the cap holds lift flat where a real wing would stall and lose it, and α\alpha keeps climbing with nothing to stop it, so the final −69.7-69.7 m is not a prediction. With the autopilot off the aircraft just glides, 236.8236.8 m low at 6060 s. The honest conclusion is qualitative: altitude hold is the wrong law after an engine failure and should hand over to speed hold.

What the autopilot gets wrong

Windup. Climb +100+100 m with the elevator limited to 3.5∘3.5^\circ and no command rate limit. With anti-windup: overshoot 5.0635.063 m, settling 20.0420.04 s, saturated 9.749.74 s. Without it the integrator keeps charging against the stop: overshoot 62.66062.660 m, settling 38.2838.28 s, saturated 27.027.0 s, minimum speed 38.4938.49 m/s. With a 5∘5^\circ limit, 7.6987.698 m against 48.25748.257 m. The gains are fine; a linear design is being asked for more than its limits allow.

Nonlinearity far from trim. The heading change at larger bank limits: at 45∘45^\circ the altitude error peaks at 5.6505.650 m and α\alpha at 5.484∘5.484^\circ; at 60∘60^\circ, 10.67110.671 m and 9.442∘9.442^\circ (load factor 1/cos⁡ϕ=21/\cos\phi = 2), with elevator 10.548∘10.548^\circ and speed down to 48.0448.04 m/s; at 70∘70^\circ, 13.11913.119 m and 12.496∘12.496^\circ. Aileron nearly saturates at 45∘45^\circ (19.993∘19.993^\circ) and sits on its 20∘20^\circ stop from 60∘60^\circ. My reading, not a separate test: the linear model has no 1/cos⁡ϕ1/\cos\phi lift loss, so the altitude loop hears of it only after the aircraft sinks.

Unmodelled actuator lag. In the 25∘25^\circ turn the bank peak is 25.036∘25.036^\circ at τ=0.05\tau = 0.05 s, 27.134∘27.134^\circ at 0.60.6 s, 29.499∘29.499^\circ at 1.01.0 s and 31.305∘31.305^\circ at 1.51.5 s. A rate limit of 8∘8^\circ/s alone gives 33.690∘33.690^\circ. The loop has lost phase it was designed to have (13.5 Frequency Response & Bode Plots).

Noise. At σ=1\sigma = 1 m in level flight the elevator’s rms movement about trim is 0.042∘0.042^\circ with the observer (L=1L = 1) and 0.644∘0.644^\circ without, fifteen times more, with the elevator hitting its 60∘60^\circ/s rate limit. L=10L = 10 gives 0.258∘0.258^\circ; L=0.2L = 0.2 gives 0.010∘0.010^\circ but a slower estimate. Observer off with σ=3\sigma = 3 m: 1.389∘1.389^\circ.

Computing it

The playground reduces windup to its smallest form. The plant is h˙=2 sat(u)\dot h = 2\,\mathrm{sat}(u) with a limit of 11, the controller is u=0.5e+0.2zu = 0.5e + 0.2z with z˙=e\dot z = e, and the command is a 5050 m step, with h=0.02h = 0.02 s, over 8080 s. Without anti-windup the overshoot is 45.2145.21 m and the command is saturated for 79.7879.78 s; with conditional integration the overshoot is 0.360.36 m and the saturated time 24.0224.02 s. It also prints the discrete roll pole e−33.1348×0.02=0.5155e^{-33.1348 \times 0.02} = 0.5155.

🐍 PythonToy windup: a saturated PI loop with and without conditional integration
⌘/Ctrl + Enter

The exercise. Write the discrete LQR that the autopilot uses: iterate the Riccati equation P←Q+ATP(A−BK)P \leftarrow Q + A^{\mathsf T}P(A - BK) with K=(R+BTPB)−1BTPAK = (R + B^{\mathsf T}PB)^{-1}B^{\mathsf T}PA until it settles. The tests are a scalar case with a known golden-ratio answer and a double integrator sampled at 0.10.1 s.

🧪 Coding exerciseExercise: discrete LQR by Riccati iteration
⌘/Ctrl + Enter

Concept checks

✅ Concept check

In a level coordinated turn at $25^\circ$ of bank, what is the load factor $1/\cos\phi$?

✅ Concept check

The elevator is limited to $3.5^\circ$ in a $+100$ m climb. With anti-windup off the altitude overshoots by $62.660$ m instead of $5.063$ m. Why?

✅ Concept check

With a $1$ m noisy altimeter, the elevator's rms movement is $0.042^\circ$ with the observer and $0.644^\circ$ without. What does the observer do?

✅ Concept checkselect all that apply

Select all that this simulator does NOT include.

Problems

✏️ Pen & paperHow long is the turn?●○○

At 5050 m/s and g=9.81g = 9.81 m/s2^2, find the turn rate in a coordinated turn at 25∘25^\circ of bank, and the time to turn 90∘90^\circ at that rate. Why did the lab take longer?

Show worked solution

ψ˙=gtan⁡ϕ/V=9.81×0.46631/50=0.09149\dot\psi = g\tan\phi/V = 9.81 \times 0.46631/50 = 0.09149 rad/s =5.242∘= 5.242^\circ/s. Ninety degrees takes 90/5.242=17.1790/5.242 = 17.17 s. The lab took 23.6223.62 s to get within 1∘1^\circ: the heading loop is proportional and the bank is rolled in first, so the aircraft turns at the steady rate only in the middle, and the last degrees take time to close.

✏️ Pen & paperHow much windup?●●○

The integral gain from the elevator’s LQR row is 0.0041020.004102 rad per metre-second. Suppose the aircraft is held 6060 m below its target for 1010 s while the elevator is saturated, and the integrator is not frozen. How much elevator does the integral term alone demand when the aircraft arrives?

Show worked solution

The integral is 60×10=60060 \times 10 = 600 m s, so the term is 600×0.004102=2.461600 \times 0.004102 = 2.461 rad, about 141∘141^\circ. The elevator saturates at 25∘25^\circ, so the integral term dominates the command until the integrator is pulled back down by an overshoot of the opposite sign. That demand is far beyond the limit, and so the elevator stays stuck long after the error has reversed.

✏️ Pen & paperIs RK4 safe at 0.02 s?●●●

The fastest closed-loop root is −33.1348-33.1348 s−1^{-1} in the lateral loop. RK4 is stable on y˙=λy\dot y = \lambda y when −2.785≤hλ≤0-2.785 \le h\lambda \le 0 (4.5 Stability Regions & Stiffness). Find hλh\lambda at h=0.02h = 0.02 s, the largest stable hh, and the discrete pole of the zero-order-hold model.

Show worked solution

hλ=−33.1348×0.02=−0.6627h\lambda = -33.1348 \times 0.02 = -0.6627, inside the interval. The largest stable step is 2.785/33.1348=0.08412.785/33.1348 = 0.0841 s, about four times the step used. The ZOH discrete pole is e−0.6627=0.5155e^{-0.6627} = 0.5155, inside the unit circle. A faster root, or a stiffer actuator, would shrink that margin, and above 0.0840.084 s RK4 would be unstable for that root.

What comes next

A real flight-dynamics tool adds what this lacks: stall and post-stall aerodynamics from measured tables, a standard atmosphere, ground effect and gear, engine and propeller models, turbulence spectra, structural flexibility, sensor and computer delay, and gain scheduling so the controller changes with speed and altitude instead of being one design at one trim. Its coefficients come from flight test, ours from memory. The physics arc ends here: derivatives and vectors, the flow equations and a solver, then an aircraft and a controller flying inside it.

The next row in the course is L-9.1, 9.1 What Is a PDE? Conservation Laws & Classification, on conservation laws and classification.

Key Takeaways

  • The simulator is the 12.4 aircraft with thirteen states and quaternions, RK4 at 0.020.02 s, plus assumed actuator limits, a vertical gust and a noisy altimeter; stall, density, ground, flexibility and delay are absent.
  • Trim at 5050 m/s is α=2.6606∘\alpha = 2.6606^\circ, elevator −2.7452∘-2.7452^\circ, throttle 0.38800.3880; the nonlinear-to-linear gap grows from 0.3%0.3\% to 7.1%7.1\% as the kick grows from 0.020.02 to 0.50.5 rad/s.
  • One discrete LQR gives pitch, speed and altitude hold, its elevator row reading as a PID; a bank LQR with a proportional heading loop gives roll and heading hold, and its rudder row is the yaw damper.
  • Altitude step: 9.7279.727 m overshoot, 30.6230.62 s settling; gust of 55 m/s: 8.5548.554 m against 15.32415.324 m with no autopilot.
  • Windup: with a 3.5∘3.5^\circ elevator limit overshoot goes from 5.0635.063 m to 62.66062.660 m without conditional integration.
  • Far from trim the design degrades (10.67110.671 m at 60∘60^\circ bank), and actuator lag raises the 25∘25^\circ bank peak to 31.305∘31.305^\circ at τ=1.5\tau = 1.5 s.
  • Past the lift cap the simulation is not a prediction, and the observer cuts noise at the elevator from 0.644∘0.644^\circ to 0.042∘0.042^\circ rms.
Finished this lesson?

Mark it complete to track your progress (saved in this browser). Reading every section does this for you.