I wanted to learn from an established flight-dynamics reference while making its implementation easier to run, inspect, and build on in a constrained student environment.
Engineering case study · Aerospace & Autonomy · 2026
Flight Dynamics Toolkit — Stengel FLIGHTv2 Reproduction
A restructured, configuration-driven version of Robert F. Stengel’s FLIGHTv2.m six-degree-of-freedom simulation. The underlying physics is intentionally preserved while global state, hard-coded conditions, and tightly coupled files are replaced with modular components, JSON scenarios, tests, and documented MATLAB/GNU Octave portability.
Central idea
What this system investigates.
This is not a new flight-dynamics model. Its contribution is making an established simulation easier to inspect, configure, test, reproduce, and extend without silently changing its numerical behavior.
Problem
Why this system exists.
The original FLIGHTv2 implementation is an established instructional flight-dynamics simulation, but its use of numerous global variables, hard-coded flight conditions, repeated aircraft-data reads during integration, and an undocumented legacy dependency made it harder to configure, test, reuse, and run in a student-accessible environment. The engineering task was to improve the software structure while deliberately preserving the underlying numerical model.
System architecture
How the system is organized.
- Load a documented JSON flight scenario
- Construct aircraft and control-history data
- Evaluate the original aerodynamic and motion equations through modular components
- Solve the documented trim condition
- Integrate the flight with the configured numerical method
- Compare the refactored output against the original implementation
- Export plots and numerical results for inspection
Implementation
Methods and engineering choices.
The code is reorganized into classes and modules for the aircraft, control history, trim solver, flight simulation, equations of motion, kinematics, atmosphere, and helper functions. Scenario inputs are moved into JSON configuration, data construction is separated from execution, and the implementation is designed to work with licensed MATLAB and GNU Octave. Numerical behavior is checked against the original implementation using matching inputs rather than assuming that a clean refactor is automatically equivalent.
Results and evidence
What the current record demonstrates.
- Reorganizes Robert F. Stengel’s FLIGHTv2.m supplement into a configuration-driven and testable MATLAB/Octave project; the underlying model is credited to the original author.
- The repository documents zero absolute difference for tested pure-function layers including atmosphere, direction-cosine matrix, quaternion rotation, wind-field, and event helpers.
- Aircraft aerodynamic coefficient lookups are documented as matching the original AlphaModel.m and MachModel.m across a spread of tested states and controls.
- The equations-of-motion equivalence checks document zero absolute difference across 12 combinations of state, control history, and run mode.
- The trim solver reproduces the documented original trim point at 3,050 m and Mach 0.3 with zero absolute difference in the comparison recorded by the repository.
- A complete 30-second elevator-doublet run with 1,601 time steps is documented as matching the original trajectory with zero absolute difference in both Euler and quaternion modes.
- Portability decisions account for MATLAB/Octave differences, including class-property syntax, optional arguments, and the fact that matlab.unittest is not available in GNU Octave.
Verification
Checks performed and their scope.
- Verification is based on running the original and refactored implementations with identical inputs and comparing numerical outputs, not merely reviewing source-code similarity.
- The repository documents function-level, trim, equations-of-motion, and end-to-end trajectory comparisons.
- The original implementation’s documented behavioral quirks are preserved when needed for equivalence and described rather than silently corrected.
Limitations
What this work does not yet establish.
- Numerical equivalence shows behavior preservation for the tested cases; it does not independently establish that the original physical model is correct.
- The toolkit is a restructured implementation of an established educational model, not a novel flight-dynamics formulation or an aircraft-specific validated digital twin.
- The documented comparisons do not replace independent physical validation against flight-test, wind-tunnel, CFD, or another independently validated aircraft model.
- The test-suite framework differs by environment: MATLAB uses matlab.unittest, while Octave equivalence is checked through direct comparison runs.
- The original model’s assumptions and limitations remain relevant even where the refactor reproduces its outputs exactly.
Engineering decisions
Decisions that define the model boundary.
- Preserve the original physics and numerics; focus the work on structure, configuration, portability, and verification.
- Replace extensive global state with explicit objects and module boundaries so aircraft data and control history are easier to reason about.
- Move flight conditions into JSON scenarios rather than editing the simulation entry point to change conditions.
- Avoid loading aircraft lookup data from disk inside every integration step.
- Keep known behavior quirks documented rather than turning a refactor into an unreviewed model change.
- Attribute the underlying equations, aerodynamic model, and simulation architecture to Robert F. Stengel.
A note from the build
What stayed with me.
A refactor can look cleaner and still change behavior through small implementation details. Direct, matched-input comparisons made equivalence a testable question instead of an assumption.
I learned to separate improving software structure from changing the physical model—and to attribute prior work clearly while showing exactly which numerical comparisons support the result.
Next step
What I would investigate next.
Keep the original-equivalence tests reproducible across supported environments, improve scenario and test documentation, and use the toolkit as a transparent reference alongside the from-scratch 6-DOF simulator when comparing modeling choices and numerical behavior.
Source and related work