← Projects/P-04
Quadcopter state-space model and linearization
The second of five mini-projects for ME 527 Modern Control Systems at Embry-Riddle. The course supplied a 12-state nonlinear quadcopter model with aerodynamic drag, its parameters and two example simulation scripts. I linearized the model about hover into A, B, C and D and analyzed its modes. Then I ran the linear model against the nonlinear one until the two disagreed. The most useful result came from that last step: how long and how far the approximation holds, and which neglected term breaks it.
- 2.2×10⁻⁷
- largest gap between the hand-derived and finite-difference Jacobians
- 6 / 4
- algebraic / geometric multiplicity of λ = 0, so A is not diagonalizable
- < 0.02 %
- Vx gap at 40 s after a 0.02 rad tilt, once quadratic drag is removed from the nonlinear model
- 4.4 s
- how long the linear Vx stays within 5 % of the nonlinear model after a 0.02 rad tilt
01Hover, linearized and checked
The assignment supplied the nonlinear model. It has 12 states (position, velocity, Euler angles and body rates) and 5 inputs (thrust, three torques and gravity). Every axis has linear and quadratic aerodynamic damping, and the model includes rigid-body gyroscopic coupling. Setting every derivative to zero gives the hover point: all velocities and rates zero, level attitude, no torques, and T = mg = 9.81 N for the 1 kg vehicle.
I linearized the model by hand, assuming small angles and small rates. Tilt enters the horizontal acceleration as gθ and −gφ. Quadratic drag has zero slope at v = 0, so it drops out. The gyroscopic terms are products of rates and vanish too. Only the six linear damping coefficients remain in A. I checked the hand-derived A and B against a symbolic Jacobian of the supplied function, which matched exactly. A central finite-difference Jacobian differed from them by at most 2.2×10⁻⁷.
- Eigenvalues: 0 (algebraic multiplicity 6, geometric 4), −0.1 (×2, Vx and Vy) and −0.2 (×4, Vz, p, q and r). The stable modes have time constants of 10 s and 5 s.
- A is not diagonalizable. The X–θ and Y–φ chains form two 2×2 Jordan blocks, so a constant tilt produces a position term that grows with t. Without feedback, hover is unstable, not just marginally stable.
- The closed-form responses match lsim. The zero-input response from the state-transition matrix matches lsim to 6×10⁻¹². The thrust-pulse case first disagreed by 5 mm in height. The cause was the pulse definition. Writing it as t ≤ 0.5 s on a 1 ms grid gave lsim's zero-order hold one extra sample (0.001 N·s ÷ c1z = 0.005 m). With the pulse redefined as t < 0.5 s, the difference fell to 1.7×10⁻¹³.
02Three tests against the nonlinear model
I simulated both models from the same starting conditions. The nonlinear one ran in ode45 with tight tolerances (relative 10⁻¹⁰) and the linear one in lsim.
- Hover. Starting from x(0) = 0 with T = mg, all 12 nonlinear states stay exactly zero for 50 s.
- Pitch disturbance, θ(0) = 0.02 rad. Nothing pulls the attitude back, so θ holds in both models. For the first 2 s, Vx agrees to within about 1 % (0.3 % at 1 s, 1.2 % at 2 s). After that the models separate. The linear Vx tends to gθ₀m/c1x = 1.96 m/s. The nonlinear Vx settles at 1.22 m/s, where linear plus quadratic drag balance the tilted thrust (0.1v + 0.05v² = mg sin θ₀). At 40 s the Vx error is 58 %, and X is 59.2 m in the linear model against 42.3 m in the nonlinear one. Over the same 40 s the nonlinear vehicle also sinks about 0.5 m. That is a second-order effect of the tilt, so the linear model predicts no height change.
- Thrust pulse, 1 N for 0.5 s. Peak Vz differs by 0.79 % (0.4758 vs 0.4721 m/s). Height at 30 s differs by 11.6 % (2.494 vs 2.234 m). At peak speed, quadratic drag adds roughly 24 % to the deceleration (0.022 N on top of 0.094 N). It keeps acting, more weakly, for the rest of the coast. The linear height approaches the impulse divided by the damping, 0.5 N·s ÷ c1z = 2.5 m.
03Where the linear model stops being true
To find which neglected term causes the gap, I re-ran the pitch test with quadratic damping switched off. Every other nonlinear term stayed in: the rotation matrix, the Euler kinematics and the gyroscopic coupling. The Vx difference from the linear model fell below 0.02 % at 40 s. So for this small tilt, the small-angle approximation costs almost nothing. Nearly all of the error comes from quadratic drag, which equals linear drag at 2 m/s on every translational axis. This test does not exercise the gyroscopic coupling. Coupling needs two non-zero body rates at once, and every test moves one axis at a time.
I then swept the size of the disturbance:
- The linear Vx stays within 5 % for 10.1 s at θ(0) = 0.005 rad, 4.4 s at 0.02 rad, 1.8 s at 0.1 rad and only 0.3 s at 0.5 rad.
- sin θ ≈ θ is within 1 % up to about 0.25 rad (14°). At 0.3 rad the Vx error at 40 s is 3.8 % even with quadratic drag removed.
- After a thrust pulse, the linear final height is off by about 3 % at 0.25 N, 5.9 % at 0.5 N and 11.6 % at 1 N. Peak Vz stays within 1 % up to 1 N.
So the linear model works over short horizons and small disturbances. It has no single safe speed, because quadratic drag grows with speed. The 1 N pulse peaks at only 0.47 m/s, yet the linear final height is still 11.6 % too high. Beyond about 0.2 rad, the small-angle approximation adds error of its own. A feedback controller is meant to keep the vehicle close to hover, and that is where the model is most accurate.