
Welcome to the course!
In this introductory session, we set the stage for our engineering journey. We are moving beyond static textbooks to build a living, breathing flight simulator from scratch.
Here is what we will cover:
The Engineering Pipeline: How we will integrate OpenVSP (Aerodynamics) and Gasturb (Propulsion) data into our MATLAB physics engine.
From Data to Simulation: Transforming raw lookup tables and F=ma equations into a dynamic Full Mission Profile.
The End Goal: A sneak peek at the final result, a fully autonomous T-38 Talon performing take-off, and landing.
Let's fasten our seatbelts and get started!
In this lecture, we establish the physical and mathematical foundation for our simulation framework.
Key topics covered:
The Four Forces of Flight: A deep dive into Lift, Drag, Thrust, and Weight interactions.
Thrust Analysis: Interpreting real-world T-38 flight test data to understand Thrust Required vs. Thrust Available curves.
Coordinate Systems & Transformations: Understanding the critical difference between Body-Fixed and Vehicle-Carried (NED) coordinate systems and how to use rotation matrices (essential for 6-DOF equations of motion derivation).
In this lecture, we define the "Objective System" for our simulation: The Northrop T-38 Talon.
We will cover:
Aircraft Geometry: Detailed specifications of the wing, tail, and fuselage.
Propulsion System: Analyzing the J85-GE-5 turbojet engine and thrust data.
Moment Characteristics: Locating the Center of Gravity (CG) and Aerodynamic Centers (AC) relative to the reference datum.
Aerodynamic Coupling: Understanding why we treat the aircraft as a coupled system rather than summing isolated components.
In this lecture, we shift focus from theory to practical application by building the data foundation for our flight simulation. A flight dynamics model is only as good as the data feeding it. We will explore how to acquire, generate, and structure the aerodynamic and propulsive forces required for the T-38 Talon case study. You will learn to combine legacy data from literature with modern simulation tools to create comprehensive lookup tables.
What You Will Learn:
Data Digitization: How to extract precise aerodynamic coefficients from static images and legacy plots using the MATLAB tool GrabIt
Aerodynamic Decomposition: Techniques for breaking down Lift and Moment coefficients into their linear stability derivatives to accurately model control surface effectiveness.
Propulsion Modeling: How to model engine performance by generating Net Thrust tables for both Dry and Wet (afterburner) regimes using GasTurb software.
Data Gap Filling: Using OpenVSP to generate missing aerodynamic data, such as drag polars and Mach-dependent variations, where textbook data is insufficient.
In this lecture, we transition from static data collection to dynamic simulation. We will derive the core "Physics Engine" of our simulator by establishing the Equations of Motion (EoM). While Newton's laws are intuitive, applying them to an aircraft requires careful handling of rotating reference frames.
We will mathematically bridge the gap between the forces we calculated in previous lectures and the actual movement of the aircraft. This involves translating Aerodynamic and Propulsive forces into accelerations, velocities, and positions using rigid body dynamics.
What You Will Learn:
Rigid Body Dynamics: Deriving the full 6-Degrees-of-Freedom (6-DoF) equations for both Translational and Rotational motion, accounting for the non-inertial nature of the aircraft's body-fixed axis.
Coordinate Transformations: How to mathematically relate the aircraft's Body-Fixed frame to the Earth-Fixed Inertial frame using rotation matrices.
Model Simplification: Techniques for reducing the complex 6-DoF equations down to a focused 3-DoF Longitudinal Model by eliminating lateral variables, making it suitable for performance analysis.
Numerical Integration: Moving from theory to code by applying Euler’s Method to solve these differential equations step-by-step, allowing us to simulate flight trajectories over time.
Sensor Logic: Understanding how physical sensors like Pitot tubes and Gyroscopes relate to our mathematical variables.
By the end of this video, you will have the complete set of differential equations needed to simulate the longitudinal flight of the T-38, ready to be implemented in MATLAB.
This is the "Hello World" moment for our flight simulator. In this lecture, we open MATLAB and begin scripting the main architecture of our simulation. We will translate the differential equations derived in the previous section into a structured code format.
We will focus on "Phase 1: Initialization," setting the stage for the time-marching loop. This involves defining the simulation clock, loading the aircraft's geometric and mass properties, and most importantly, establishing the Initial Conditions.
What You Will Learn:
Simulation Architecture: How to use MATLAB Structures (struct) to cleanly organize complex data (Aerodynamics, Environment, and State Vectors) rather than using loose variables.
Defining State Vectors: How to initialize the 6-element state vector that the solver will update in every iteration.
Handling Singularities: A practical "Pro Tip" on why we initialize velocity to 0.5 m/s instead of 0.0 m/s to prevent "Divide-by-Zero" errors in aerodynamic angle calculations.
Atmospheric Setup: Implementing the standard atmosphere model (atmosisa) to determine air density and speed of sound at ground level.
Control Inputs: Configuring the aircraft for a maximum performance takeoff (Throttle = 1.0, Afterburner ON).
In this lecture, we construct the "DNA" of our virtual aircraft. We will write the T_38_General_Data function, which serves as the central repository for every physical characteristic of the T-38 Talon.
Instead of hard-coding values into our physics loop, we will create a robust MATLAB Structure (Airplane) that organizes geometry, mass, aerodynamics, and propulsion into a single, easy-to-pass object. This lecture is critical for "Data Fusion", taking the raw .mat files we generated in previous sections and converting them into high-speed lookup tables ready for real-time interrogation.
What You Will Learn:
Struct Hierarchy: How to design a clean, nested data structure (e.g., Airplane.Geo, Airplane.Engine.Dry) to keep your simulation organized and scalable.
High-Speed Interpolation: Why we use MATLAB's griddedInterpolant instead of standard interp2 functions. Note: This is a major performance optimization that speeds up the simulation by pre-calculating the grid overhead.
Data Fusion: Loading and validating external dependencies (T38_Aero_Data.mat and J85_Engine_Performance.mat) with robust error handling to prevent crashes.
Stability Derivatives: Defining the constant aerodynamic derivatives that determine how the aircraft responds to pilot inputs.
In this lecture, we code the "heart" of our flight simulator: the FlightDynamics function. This is where the physics actually happens. We will translate the theoretical 3-Degree-of-Freedom (3-DoF) equations derived in Lecture 4 into a robust MATLAB function that calculates the forces and moments acting on the T-38 in real-time.
You will learn how to build a "State Derivative" calculator, a function that takes the current state of the aircraft (position, velocity, orientation) and pilot inputs, and calculates exactly how those states should change in the next millisecond.
What You Will Learn:
Kinematic Conversions: Calculating derived flight variables like Angle of Attack, Flight Path Angle, and Dynamic Pressure from the raw state vectors.
Coordinate Transformations: Implementing Rotation Matrices to correctly transform Lift and Drag from the "Stability Axis" (wind-relative) into the "Body Axis" (pilot-relative), and finally to the "Earth Axis" (navigation).
Aerodynamic Buildup: Coding the linear coefficient equations and adding drag penalties for Landing Gear and Speed Brakes to the Drag Polar.
Propulsion Logic: Implementing the conditional throttle logic that seamlessly switches the J85 engines from Dry Thrust to Wet Thrust (Afterburner) when the throttle exceeds 90%.
Ground Physics: Developing a simplified landing gear interaction model that calculates Normal Force and Friction to allow for realistic taxiing and takeoff rolls.
State Derivative Calculation: Solving Newton’s Second Law to output the accelerations that the integrator needs for the next time step.
In this lecture, we officially begin our Full Mission Profile simulation. We will translate the theoretical physics of flight into a computational algorithm, focusing specifically on getting our T-38 aircraft from a standstill to clearing the obstacle height.
We will deconstruct the Take-off maneuver into three distinct mathematical phases, defining the specific Boundary Conditions and Equations of Motion required for each:
Ground Roll: Modeling the acceleration phase on the runway, accounting for rolling friction coefficient, aerodynamic drag, and thrust accumulation up to Rotation Velocity.
Rotation: Implementing the control logic required to pitch the aircraft nose-up. We will discuss why we neglect complex dynamic derivatives for this level of analysis and how to trigger Lift-off.
Airborne: The final transition phase where the aircraft leaves the ground effect and climbs to the safety altitude.
What you will learn in this session:
Simulation Architecture: How to structure sequential While loops in MATLAB to govern the transition between flight phases automatically.
PID Control Integration: An introduction to using a Proportional-Integral-Derivative controller to manage the aircraft's pitch attitude during the critical Rotation.
State Vector Propagation: How to update the aircraft's position and velocity vectors using numerical integration over time steps.
Physics-Based Logic: Defining the logical flags that tell our code when to switch from "Ground Dynamics" to "Flight Dynamics".
By the end of this video, you will have the complete algorithmic flowchart and theoretical understanding needed to write the MATLAB code for the takeoff simulation in the next lecture.
In this coding session, we open MATLAB to implement the physics we discussed in the previous lecture. We will script the Ground Roll Phase, taking our T-38 from a complete stop to its rotation speed.
Crucially, this lecture also establishes the Post-Processing and Visualization infrastructure that we will use for the rest of the course. We won't just generate numbers; we will build a professional engineering dashboard to visualize forces, moments, and trajectory in real-time.
What you will learn in this session:
Euler Method Integration: How to write the numerical integration code to update our state vectors (Position, Velocity, Pitch Attitude) at every time step.
Velocity-Based Logic: Implementing the While loop condition to automatically detect when the aircraft reaches 1.1*V_stall, triggering the end of the ground roll phase.
Stick-Fixed Dynamics: Configuring the control inputs for the takeoff run (Throttle set to 1.0, Elevator set to Neutral/0).
Data Unpacking: Efficiently converting complex MATLAB Structures (SimLog) into linear arrays to prepare for analysis.
Mission Dashboard Creation: Using MATLAB's tiledlayout to plot a comprehensive 12-chart analysis panel, displaying critical parameters like SFC, AoA, and Mission Trajectory side-by-side.
By the end of this video, you will have a running simulation that successfully accelerates the aircraft along the runway and produces a detailed graphical report of the performance.
In this session, we execute the Rotation Phase, arguably the most critical transient maneuver in the takeoff profile. Now that our aircraft has reached rotation speed, we must command the elevator to pitch the nose up to the target attitude to generate sufficient lift for flight.
What you will learn in this session:
Liftoff Logic: Defining the physical condition for becoming airborne. We will script the While loop to run specifically until the Normal Force on the landing gear drops to zero.
Controller Configuration: How to define the ControlConfig structure, set the necessary gains, and feed the pitch error into our simulation loop to drive the elevator deflection.
Pitch Target Management: transitioning the simulation from a velocity-based constraint (Ground Roll) to an attitude-based constraint.
Seamless Phase Transition: Ensuring all state variables are preserved and passed correctly from the Ground Roll phase into the Rotation phase without numerical discontinuities.
By the end of this video, you will have a simulation that not only accelerates but actively responds to control inputs to raise the nose and leave the ground.
In this session, we introduce the brain of our simulation: The Automatic Controller.
Unlike traditional academic courses that focus on "Linear Control Theory" (Transfer Functions, Laplace Transforms, Bode Plots), we will take a Non-Linear, Time-Domain approach. We will build a robust PID (Proportional-Integral-Derivative) function from scratch that interacts directly with our physics engine, allowing us to control the aircraft through aggressive maneuvers like the Take-Off Rotation.
What you will learn in this session:
Linear vs. Non-Linear Control: Understanding why standard textbook methods (Linearization) fall short for our full-physics simulation and why we use numerical integration instead.
The PID Architecture: Breaking down the role of each term:
P (Proportional): The immediate reaction to error (Rise Time).
I (Integral): The memory of past errors (Eliminating Steady-State Error).
D (Derivative): The prediction of future error (Damping & Overshoot protection).
Rotation Control Strategy: Defining our specific control objective for the T-38: rapid pitch-up without overshoot.
The RunPID Algorithm: A line-by-line breakdown of the custom MATLAB function we will use throughout the entire course. You will learn how to implement features like Integrator Windup Protection and Actuator Saturation programmatically.
By the end of this video, you will understand the logic behind the "Black Box" that will fly our aircraft, preparing you for the next lecture where we will use optimization algorithms to tune it automatically.
In this lecture, we transition from theoretical "Linear Control" concepts to a practical, simulation-based "Optimization" workflow. We will be scripting a Controller Optimizer in MATLAB that automatically tunes the T-38’s pitch control laws for the critical takeoff rotation phase.
We will focus on implementing a numerical optimization loop that replaces manual "Trial and Error" with an algorithmic approach to determine the ideal PID gains:
Non-Linear Control Strategy: Unlike academic models that linearize around a trim point, we will tune our controller against the full non-linear physics engine. This ensures the controller handles aggressive maneuvers, like rotation, where dynamic pressure and angles of attack change rapidly.
The Cost Function: We will design a custom mathematical function that defines what a "perfect" rotation looks like.
What you will learn in this session:
Numerical Optimization: How to utilize MATLAB's fminsearch (Nelder-Mead algorithm) to "fly" the aircraft virtually thousands of times to converge on the optimal solution.
Designing Constraints: How to implement "Soft Constraints" for actuator saturation and "Hard Barriers" (e.g., Pitch > 12.5°) to prevent tail strikes during liftoff.
Tuning Logic: Understanding why we prioritize some gains while forcing some to zero.
Visualizing Performance: Creating automated plots to verify the step response, control effort, and safety margins of the optimized gains.
By the end of this video, you will have a fully automated tuning script that balances the aggressive pitch-up required for takeoff with the safety constraints needed to protect the airframe.
In this lecture, we finalize the Takeoff sequence by scripting Phase 4: Airborne / Initial Climb. This is the brief but critical transition period immediately after the wheels leave the ground (Liftoff) until the aircraft clears the standard obstacle height.
What you will learn in this session:
Obstacle Clearance Definition: Implementing the standard performance metric (Screen Height) of 15 meters (approx. 50 ft) as the termination condition for the takeoff run.
State Preservation: How to pass the memory of the PID controller (RotState) from the previous loop into this new phase to prevent "actuator jumps" or instability immediately after liftoff.
Simulation Loop Logic: Writing the specific while loop that integrates the physics equations for the initial climb segment.
Full Sequence Visualization: We will conclude by running the complete code (Ground Roll + Rotation + Airborne) and plotting the results to visualize the T-38's trajectory from brake release to obstacle clearance.
By the end of this video, you will have a complete, mathematically accurate simulation of a jet aircraft takeoff, ready for the next major flight phase: The Climb.
Now that our T-38 has successfully lifted off and cleared the obstacle height, we enter the Climb Phase. In this theoretical session, we break down the aerodynamics and physics required to take an aircraft from sea level to its cruising altitude.
We will move beyond simple force balances and explore Point Performance analysis, understanding what the aircraft is capable of doing versus what we command it to do in our simulation. We will derive the fundamental Equations of Motionthat govern how excess thrust is converted into potential energy (altitude) and kinetic energy (speed).
What you will learn in this session:
The Physics of Ascent: Deriving the climb equations by resolving Lift, Drag, Thrust, and Weight relative to the flight path angle and pitch angle.
Performance Metrics:
Rate of Climb (R/C): The vertical velocity of the aircraft, driven primarily by Excess Power.
Specific Excess Power (P_s): Understanding the energy state of the aircraft and how it allows us to trade speed for altitude.
Climb Profiles: Discussing different operational strategies (Constant Throttle, Constant Speed, or Constant Pitch)
Mission Definition: Setting the boundary conditions for our upcoming MATLAB simulation:
Target Altitude: 11,000 meters.
Climb Attitude: Maintaining a constant pitch of 10°.
Target Speed: Accelerating to and holding Mach 0.6.
By the end of this video, you will have the mathematical foundation needed to construct the While loop logic for the climb phase in the next MATLAB coding session.
In this session, we advance our optimization framework significantly. While the Rotation phase was a "Single-Input Single-Output" (SISO) problem, controlling Pitch using only the Elevator, the Climb phase represents a complex Multi-Input Multi-Output (MIMO) control challenge.
In a climb, Pitch Attitude and Airspeed are heavily coupled. If you pitch up to climb, you lose speed (trading Kinetic Energy for Potential Energy). To maintain speed, you must add Throttle. Therefore, we cannot tune the Pitch Controller and Speed Controller separately; they must be tuned simultaneously to find the perfect equilibrium.
What you will learn in this session:
MIMO Optimization Setup: We will expand our optimization vector to solve for 7 distinct variables at once:
3 Gains for the Pitch Controller (Elevator).
3 Gains for the Speed Controller (Throttle).
1 "Base Throttle" setting (Feed-forward Trim).
Coupled Dynamics: Understanding how the optimizer balances the trade-off between reaching the target altitude (10° pitch) and maintaining the target energy state (Mach 0.6).
Advanced Cost Function:
Normalization: Since Mach numbers are small (0.6) and Pitch angles are large (10°), we will learn how to weight these errors to prevent the optimizer from ignoring airspeed.
Actuator Smoothing: Implementing penalties for "Bang-Bang" throttle control to ensure the engine doesn't violently oscillate between 0% and 100% power.
Trim Optimization: Unlike standard PID tuning, we will also ask the optimizer to find the ideal "Cruise Throttle" setting, reducing the workload on the Integral term.
By the end of this video, you will have a sophisticated optimization script that allows the T-38 to lock onto a precise climb profile, managing both energy and trajectory automatically.
In this lecture, we take the "Optimal Gains" calculated in the previous session and hard-code them into our Flight Dynamics Model to execute the longest segment of our mission: the Climb to 11,000 meters.
While the previous lecture was about finding the control parameters (Design), this lecture is about implementing them (Execution). We will script the "Phase 5" loop, where the aircraft must simultaneously manage its trajectory (Pitch Attitude) and its energy state (Mach Number) as it ascends through the changing atmosphere.
What you will learn in this session:
MIMO Implementation: How to structure the code to run two PID controllers in parallel within the same time step, one driving the Elevator (for Pitch Hold) and the other driving the Throttle (for Mach Hold).
Feed-Forward Control: We will utilize the optimized "Base Throttle" value (approx. 52%) as a feed-forward term. This allows the PID controller to simply "trim" the error rather than reacting from zero, resulting in a much smoother engine response.
Termination Logic: Defining the exit condition for the loop (-z_E < 11000) to seamlessly hand over the aircraft to the Cruise Phase once the target altitude is reached.
By the end of this video, you will watch the T-38 successfully climb from sea level to the Tropopause, validating that our optimized control laws remain stable even as air density and aerodynamic damping change drastically.
Having successfully climbed to our target altitude of 11,000 meters, we now transition into the Cruise Phase. In this theoretical session, we shift our focus from the "Excess Power" required for ascent to the Efficiency required for sustained flight.
We will derive the simplified Equations of Motion (EOM) for steady-level flight, where the Flight Path Angle is zero. Unlike previous phases, Cruise is a game of conservation. We will explore how the aircraft must continuously adapt its angle of attack or throttle setting to maintain altitude as it burns fuel and becomes lighter .
What you will learn in this session:
Steady-State Physics: Analyzing the force balance where Lift equals Weight and Thrust equals Drag in the absence of vertical acceleration .
Efficiency Metrics:
Specific Range (SR):T his metric tells us the distance traveled per unit of fuel consumed, which is the governing parameter for "Point A to Point B" missions.
Specific Endurance (SE): This metric measures flight time per unit of fuel, which is critical for loitering or holding patterns .
Projected Performance: How to mathematically calculate the "Distance to Empty" (Projected Range) and "Time to Empty" (Projected Endurance) based on instantaneous fuel flow.
Simulation Boundary Conditions: Setting the targets for our upcoming MATLAB implementation:
Target Speed: Maintaining a fast cruise at Mach 0.8.
Termination Condition: The simulation loop will run until the aircraft mass drops to 3750 kg, effectively modeling a specific fuel-burn segment rather than a fixed time duration.
By the end of this video, you will possess the theoretical knowledge needed to model fuel efficiency and range prediction, preparing you for the Cruise Controller optimization in the next lecture.
With the theoretical foundation of steady-level flight established, we now move to the MATLAB implementation of a robust "Altitude Hold" autopilot.
In this coding session, we face a new control challenge: We cannot simply connect the Altitude Error directly to the Elevator. Doing so would result in an unstable, oscillating system. Instead, we must mimic how a human pilot flies: we change the Pitch Attitude to affect the Altitude.
To achieve this, we will implement a Cascade Control Architecture, a hierarchical system where a "Slow" Navigation Loop dictates commands to a "Fast" Stabilization Loop.
What you will learn in this session:
Cascade Architecture Design: Understanding the master/slave relationship between two distinct controllers:
Outer Loop (Navigation): Senses the Altitude Error and calculates the Required Pitch Angle needed to correct it.
Inner Loop (Stabilization): Takes that as a command and calculates the necessary Elevator Deflection to achieve it.
The "Reference Handoff": How to programmatically link the output of the Altitude Controller to the input (Set-Point) of the Pitch Controller.
Frozen Gain Strategy: Learning why we must "freeze" the inner loop gains (tuned in the Climb Phase) to ensure stability while we optimize the outer loop.
Multi-Variable Optimization: Using the fminsearch algorithm to simultaneously tune the Altitude PID gains and the Cruise Throttle Trim to maintain Mach 0.8 at 11,000 meters.
By the end of this lecture, you will have a sophisticated autopilot capable of autonomously capturing and maintaining level flight with smooth, stable control inputs.
In this coding session, we will script the "Phase 6" logic of our flight envelope. Unlike the Climb phase which was limited by altitude, this phase is limited by fuel. We will simulate the aircraft maintaining level fligt (11,000m) at Mach 0.8 until our fuel reserves drop to the "Bingo" level.
What you will learn in this session:
Implementing Cascade Control Logic: We will write the nested code structure where the Outer Loop (Altitude Controller) calculates a dynamic Pitch Reference, which is immediately fed into the Inner Loop (Pitch Controller) to drive the elevators.
Fuel-Based Termination Condition: Instead of a fixed time loop, we will implement a while loop that runs continuously until the aircraft mass drops to the Reserve Fuel Level (3750 kg). This simulates the realistic endurance of the aircraft.
Auto-Throttle Integration: While the elevators manage altitude, we will simultaneously run a parallel PID loop to adjust the Throttle Setting to maintain a constant Mach 0.8 despite the changing aircraft weight.
State Integration: We will ensure that our equations of motion correctly update the aircraft's position over the extended duration of the cruise.
By the end of this video, your simulation will be able to autonomously fly the aircraft for hundreds of kilometers, successfully transitioning from a heavy climb to a lightweight, high-efficiency cruise state.
In this theoretical session, we analyze the Descent and Approach phases. Unlike the Cruise phase where Thrust balanced Drag, here we rely on Gravity. We will explore how to manage the aircraft's Potential Energy to maintain a safe airspeed without using fuel.
What you will learn in this session:
Equations of Motion (EOM) for Descent: Deriving the force balance equations where Thrust is effectively zero and the weight component drives the aircraft forward against Drag.
Performance Metrics: Understanding some gliding parameters.
The "No-Flap" Landing Strategy: Since our simplified T-38 model does not include flaps, we cannot rely on geometry changes to generate high lift at low speeds. Instead, we will design a "High Alpha" profile:
Descent Mode: Holding 8° Angle of Attack at Idle Thrust.
Approach Mode: Increasing to 12° AoA to minimize touchdown speed.
Simulation Architecture: Defining the specific boundary conditions for the upcoming MATLAB lectures:
Descent Target: Descend until 500m.
Approach Target: Decelerate and descend to the threshold altitude of 15m.
By the end of this video, you will understand the physics of unpowered flight and have the roadmap needed to code the "Controller Optimizer" for the descent phase in the next lecture.
With the aircraft stable in high-altitude cruise, we now initiate the Descent Phase. In this coding session, we aim to design a controller for a "High-Drag Descent" by targeting a constant Angle of Attack (Alpha) of 8.0°.
In this lesson, we will push the control logic to its limits and confront an important reality of aeronautical engineering: Physical Saturation. While our mathematical model demands an 8.0° Alpha for maximum aerodynamic braking, we will analyze why the T-38's airframe and elevator authority may fight back against this command.
What you will learn in this session:
Constraint-Aware Tuning: Designing a Cascade Controller (Alpha loop driving Pitch loop) intended for high-performance maneuvers.
Theory vs. Reality: We will observe the "Battle of Physics" where we attempt to hold 8.0° AoA, and analyze the data to understand why the aircraft settles for a lower equilibrium.
Cost Function Realities: How to tune an optimizer (fminsearch) that tries to minimize error even when the physical target is mathematically unreachable.
By the end of this lecture, you won't just have a descent controller; you will have a deeper understanding of the flight envelope limits and how to interpret simulation results when physics says "no."
In this coding session, we add "Phase 7" to our flight script. This is where we transition from steady-level cruise to a high-drag descent configuration. We will program the autopilot to cut the throttle to IDLE, deploy the Speed Brakes (100%), and strictly follow the Alpha commands to manage the aircraft's energy state.
Key implementations in this lesson:
Aerodynamic Configuration: Hard-coding the actuators for maximum drag (Throttle: 0%, Speed Brake: 100%) to dissipate potential energy without overspeeding.
Cascade Integration: Writing the nested RunPID calls where the Alpha Controller (Outer Loop) dictates the target for the Pitch Controller (Inner Loop).
Phase Termination Logic: Defining the "Handoff Gate" at 500m. This specific altitude is critical as it sets the initial conditions for our final and most difficult phase: The Approach & Flare.
Real-Time Monitoring: setting up the simulation loop to print live telemetry (Altitude, Alpha, Gamma) to verify if our controller is fighting the physics or working in harmony with it.
By the end of this video, your T-38 will successfully leave the cruise altitude and descend autonomously to the approach gate, ready for the final landing sequence.
In this coding session, we develop a "Constrained Approach" autopilot. Unlike the previous descent phase where we simply managed energy, here we must aim onto a specific Flight Path Angle (Gamma) of -4.0° to guide the T-38 safely to the runway threshold.
What makes this controller special? We are introducing Active Envelope Protection. You will learn how to write "Rule-Based Logic" that overrides standard control inputs when the aircraft approaches its physical limits.
Key concepts covered in this lecture:
Gamma Tracking Strategy: Reconfiguring the Cascade Architecture to use Flight Path Angle as the Navigation variable, driving the Pitch loop.
Stall Protection Logic (Alpha Floor): Implementing a safety layer that autonomously applies MAX THROTTLE if the Angle of Attack exceeds 12.0°, preventing a stall regardless of the descent command.
Automatic Drag Management: Writing dynamic logic that modulates Speed Brakes based on Alpha, ensuring we have enough drag to descend but not enough to stall.
Safe Optimization: Tuning the PID gains not just for speed, but for safety. We configure the cost function to heavily penalize any solution that violates the 12° Alpha limit.
By the end of this video, you will have designed a smart autopilot that "knows" its limits, a system that aggressively tracks the runway path but refuses to fly the aircraft into a dangerous state.
We have tuned our controller, and now it's time to test it in the Main Simulation Loop. In this session, we attempt to guide the T-38 onto a -4.0° Glide Path.
However, simulations are brutally honest, and in this specific phase, we come face-to-face with a major aerodynamic constraint.
The "Missing Flaps" Reality: As you will see in the video, our simulation model currently lacks High-Lift Devices (Flaps). Without flaps, the aircraft cannot generate sufficient lift at low speeds without maintaining a high Angle of Attack. This creates a chain reaction: High Alpha leads to high Induced Drag. To maintain speed against this drag without thrust (Idle), the physics dictates that the aircraft must descend steeply.
What you will analyze in this lesson:
Theory vs. Reality: We attempt to command a shallow -4.0° path, but the "clean wing" configuration forces the aircraft into a Natural Equilibrium of ~ -7.0°.
The "No-Flap" Penalty: You will clearly observe why flaps are essential for standard approaches. We will discuss how their absence forces us into this aggressive, tactical-style descent to avoid stalling.
Active Envelope Protection: Even though the physical setup prevents capturing the shallow path, our safety logic works perfectly. You will see the Alpha Floor protection kicking in to prevent the autopilot from pulling the nose up into a stall while trying to chase the impossible target.
The 15m Gate: Despite the steep descent, we successfully guide the aircraft to the 15m "Flare Threshold," setting up the final touchdown logic.
By the end of this video, you will understand a crucial lesson in aircraft design: Why we need flaps, and what happens when we have to fly without them.
We have successfully guided the T-38 to the "Decision Height" of 15 meters. Now, the autopilot faces its final and most difficult challenge: Touching down safely.
Landing is not a single event; it is a sequence of distinct dynamic phases, each with its own set of physics and control laws. In this theoretical lecture, we break down the "Anatomy of a Landing" into three critical stages that we will model in our simulation.
What you will learn in this session:
1. The Flare Maneuver (The Exponential Decay):
We analyze how to arrest the descent rate starting precisely at 15m.
You will learn the boundary conditions for this phase, where we keep the throttle active and manage energy to achieve a smooth touchdown.
2. Derotation (Nose Gear Protection):
Once the main wheels touch the ground, the flight isn't over. We must gently lower the nose wheel.
We will define the control logic to reduce the Pitch Angle to 0° while deploying full Speed Brakes to dump any remaining lift.
3. Ground Rollout (Braking Dynamics):
The transition from aerodynamics to ground mechanics.
We will introduce the coefficient of friction and define the termination condition for the entire simulation: when velocity drops to 0.5 m/s.
Why this theory matters: Before writing the while loops in MATLAB, we must define the "State Machine." This lecture provides the mathematical blueprint (Boundary Conditions & Exit Criteria) required to program the final autonomous landing script.
By the end of this video, you will have a clear roadmap for how to code the transition from a flying object to a rolling vehicle.
We have arrived at the most delicate phase of the flight: The Touchdown. In standard commercial aviation, a flare typically involves cutting the throttle to idle and pulling back on the stick to float onto the runway.
However, we are flying a T-38 without flaps. In this high-drag, low-lift configuration, pulling the nose up without adding energy would result in a stall and a hard crash. Therefore, we must adopt a Military/Naval approach technique: We will control our sink rate with the Throttle, not just the Elevator.
In this coding session, we tune a Multi-Input Multi-Output (MIMO) controller that mimics a carrier pilot's logic:
The Elevator is used strictly to set the Pitch Attitude (Target: 6.5°). This ensures the nose wheel stays off the ground and we land on the main gear.
The Throttle is used to arrest the Sink Rate (Target: -0.6 m/s). We effectively "cushion" the landing by adding power right before impact. What you will implement in this tuner:
The "Greaser" Objective: We define a cost function that specifically hunts for a "Butter Landing" (Sink Rate > -1.0 m/s) while heavily penalizing any impact harder than -2.5 m/s (Structural Failure).
Dual-PID Architecture: You will synchronize two separate controllers working in parallel, one managing the nose geometry, the other managing the vertical energy.
Smoothness Constraints: Tuning the derivatives to prevent the engine from "hunting" (revving up and down) during the critical final seconds.
Auto-Idle Logic: Programming the "Cut-Off" switch that kills the throttle exactly at 0.3 meters radar altitude to prevent floating down the runway.
By the end of this lecture, you will have a mathematically optimized pilot capable of executing a high-performance, power-controlled landing with surgical precision.
This is the moment of truth. We have guided the T-38 down to the 15-meter threshold. Now, we must arrest the descent rate from a tactical dive to a gentle touchdown.
In this coding session, we implement the Phase 9: Precision Flare logic. Because we are landing a high-performance jet without flaps, we cannot rely on a traditional "idle-and-float" flare. Instead, we execute a "Power-On" Flare, using the engines to actively cushion the landing.
Key implementations in this lesson:
Dual-Loop Control Strategy:
Pitch Loop: We lock the nose attitude at 6.5° to ensuring the main wheels touch first, protecting the nose gear.
Throttle Loop: The autopilot modulates thrust to target a specific sink rate (-0.6 m/s), fighting the high drag to prevent a hard impact. * The "Throttle Chop" Logic: Just like a human pilot, we program the autopilot to cut the power to IDLE exactly at 0.3 meters above the ground. This ensures the aircraft settles firmly onto the runway without floating.
Automated Landing Report: We add a reporting script that runs post-touchdown. It calculates the impact energy and grades the landing quality in the command window:
"BUTTER": Perfect execution (Sink Rate < 1.0 m/s).
"SAFE": Acceptable operational landing.
"HARD": Structural inspection required.
By the end of this video, you will run the full simulation and see if your code results in a smooth "Greaser" or a landing gear replacement!
The main wheels are on the ground, but the landing isn't over.
In this advanced coding session, we move beyond manual tuning. We will implement an Optimization Algorithm (Nelder-Mead) to mathematically determine the perfect PID gains for the Derotation phase. We treat the aircraft as a constrained system where the altitude is locked to zero, focusing entirely on the rotational dynamics to gently lower the nose wheel.
What you will learn in this session:
Automated Gain Tuning (fminsearch): Instead of guessing PID values, we define a "Cost Function" and let MATLAB's optimization engine find the ideal coefficients for us. You will learn how to convert engineering requirements into a mathematical minimization problem.
Constraint-Based Kinematics (Zero-G Height): Since the main gears are planted, we lock the altitude and vertical velocity. This simplifies the physics engine to focus purely on pitch moments, effectively removing vertical gravity integration to simulate the pivot action.
The "Shock Absorber" Cost Function: We don't just minimize error; we penalize "bad behavior." You will write a sophisticated cost function that includes:
Slam Penalty: Triggers if the nose gear impact rate exceeds the structural limit (-0.05 rad/s).
Saturation Penalty: Prevents the elevator from "banging" to full deflection instantly, ensuring a smooth actuator response.
By the end of this video, you will have a self-tuning controller that guarantees a "Butter" touchdown for the nose gear, strictly adhering to structural safety limits.
The main wheels are down, smoke is coming off the tires, but the pilot's job isn't finished.
In this coding session, we integrate Phase 10: Derotation into our main simulation engine. This is a unique phase because the physics engine changes: the aircraft is no longer a free-flying body but a lever pivoting around a fixed point on the ground.
Key implementations in this lesson:
Active Nose Damping: We implement the PID controller using the gains tuned in the previous session. You will see the elevator move to nose down.
Configuration for Rollout: Setting the aircraft up for maximum deceleration:
Throttle: IDLE (0%).
Speed Brakes: 100% (Full Deployment)
Impact Reporting: The simulation concludes this phase by printing the Nose Gear Impact Rate. We will verify if our code successfully kept the impact below the structural limit of 3 deg/s.
By the end of this video, your T-38 will have all three wheels firmly on the ground, ready for the final braking maneuver.
In this lecture, we finalize the Landing sequence by scripting Phase 11: Ground Roll. This is the deceleration phase immediately after the nose gear touches the runway, where the aircraft transitions from aerodynamic drag to mechanical braking to come to a full stop.
What you will learn in this session:
4-Point Kinematic Lock: Implementing the "Ground Constraint" logic where Pitch, Pitch Rate, Vertical Velocity, and Altitude are mathematically locked to zero, simulating a stable rollout on all three wheels.
Stick-Forward Logic: Writing the control command that pushes the stick full forward (+20° Elevator). You will learn why pilots do this to add aerodynamic downforce on the nose gear, improving steering and braking traction.
Braking Dynamics: Integrating the Coefficient of Friction and the Full Speed Brake configuration to maximize deceleration until the velocity drops below 0.5 m/s.
Full Landing Visualization: We will conclude by plotting the entire dataset (Descent + Approach + Flare + Derotation + Rollout). You will visualize the complete energy profile, altitude loss, and throttle settings from the initial approach gate down to the final standstill.
By the end of this video, you will have a complete, mathematically accurate simulation of a high-performance jet landing, ready to be combined with the takeoff phase for a full mission analysis.
In this final lecture, we take a step back to evaluate the entire engineering journey we have just completed. Building a flight simulator from scratch is a massive achievement, but a good engineer always asks: "What could have been done better?"
We will conduct a critical review of our T-38 simulation project, discussing both our triumphs and the limitations of our design choices.
Key Discussion Points:
Project Retrospective: We celebrate our ability to control an aircraft using Non-Linear Equations of Motion and perform a full mission profile analysis without relying on pre-built blocks.
Engineering Trade-offs & Improvements: We honestly analyze where our model could be improved, including:
Aerodynamics: The need for higher fidelity data (Ground Effect, Flap modeling).
Control Logic: Discussing the importance of Gain Scheduling for different flight regimes and implementing "Bumpless Transfer" (inheriting integrator states) to prevent control jumps between phases.
Math Models: Moving from Euler Angles to Quaternions to avoid gimbal lock in aggressive maneuvers.
The Road Ahead: How can you take this further? We discuss extending the model to 6-DOF , porting the physics engine to Python or C++ , or simulating completely different aircraft configurations.
Thank you for flying with me. See you in the next project! ✈️
In this lecture, we bridge the gap between conceptual design and numerical data. Since we need precise aerodynamic coefficients to build a high-fidelity flight simulation, we will use OpenVSP (Vehicle Sketch Pad) to generate our own aerodynamic lookup tables.
What we cover in this video:
Blueprint Import: Setting up a T-38 blueprint as a background reference for accurate scaling.
Geometry Modeling: Step-by-step construction of the Main Wing and Horizontal Stabilizer geometries.
Aero Analysis Setup: Configuring the VSPAERO solver for a sweep of flight conditions.
By the end of this lecture, you will be able to:
Model aircraft components in OpenVSP using external blueprints.
Run batch aerodynamic analyses to extract any coefficient you want.
Note on Modeling Assumptions & Limitations:
Geometry: In this session, we focused on the primary lifting surfaces (Wing and Tail) and assumed the fuselage's contribution to total lift is negligible for our current simulation stage.
Solver Limitations: Since OpenVSP's VSPAERO uses an inviscid solver (potential flow theory), it cannot accurately predict skin friction or separation-induced drag (viscous effects). Therefore, the data we extract will primarily focus on lift coefficient.
Efficiency is key in engineering. In this video, we focus on automating the data import process for our T-38 project. We will walk through the code available in the resources to parse the OpenVSP export files.
Key takeaways:
Using file I/O commands to read external datasets.
Filtering relevant columns (Alpha, Lift Coefficient, Drag Coefficient).
Preparing data vectors for interpolation in later modules.
Note: Please download the Obtain_Lookup_CLm script from the resources section to follow along.
OpenVSP uses the Vortex Lattice Method (VLM), which gives us perfect "Inviscid" results but fails to predict flow separation and stall. In this critical lecture, we inject reality into our simulation.
Using real experimental wind tunnel data (Mach 0.4), we will build a mathematical correction model in MATLAB to introduce stall characteristics to our linear VSP data.
What we will achieve:
Data Fusion: Combining OpenVSP outputs with experimental datasets.
Curve Fitting: Defining a quadratic penalty function to model the CL drop-off
Optimization: Using MATLAB's fminsearch to find the optimal "stall parameters" automatically.
Extrapolation: Applying the "physics rule" we discovered at Mach 0.4 to other Mach numbers (0.2, 0.6, 0.8) where we lack experimental data.
3D Visualization: Creating a professional "Carpet Plot" to visualize our final Lift Coefficient matrix.
By the end of this video, you will have a realistic, viscous-corrected aerodynamic database saved and ready for the simulation.
In this lecture, we transition from static aircraft geometry to dynamic flight control. We will be obtaining some important derivatives in VSPAERO.
We will focus on determining two critical control derivatives for our T-38 physics engine:
CM_delta (Pitch Control Power): How much pitching moment is generated per degree of elevator deflection?
CL_delta (Lift Control Effect): How does the elevator input affect the total lift?
What you will learn in this session:
VSPAERO Analysis: How to set up a "Stability Derivative" analysis in OpenVSP for different control surface deflections.
The Finite Difference Method: Using the "Slope Calculation" technique to derive control derivatives from raw aerodynamic data.
Jupyter Notebook Implementation: A step-by-step guide to coding these calculations in Python.
Engineering Assumptions: Understanding the "Linearization" of aerodynamic coefficients at a trim point (Mach 0.4) and why this is a standard practice for takeoff and climb simulations.
By the end of this video, you will have the exact mathematical coefficients needed to make your Flight Dynamics Model pitch up and rotate realistically during the simulation.
In this lecture, we bridge the gap between propulsion design and flight simulation. We will be exporting the raw performance data from GasTurb and building a robust MATLAB automation script to process it.
We will focus on generating two distinct performance envelopes for our J85-GE-5 engine model:
Dry Thrust (Military Power): The baseline thrust map without the afterburner, used for standard cruise and loiter operations.
Wet Thrust (Afterburner On): The augmented thrust envelope required for takeoff and supersonic flight regimes.
What you will learn in this session:
Handling "Messy" Engineering Data: How to write a MATLAB script to parse complex, multi-block Excel exports from GasTurb 15.
Scattered to Grid Interpolation: Using MATLAB's scatteredInterpolant and meshgrid functions to convert raw, irregular data points into structured 3D Lookup Tables.
Batch Processing: Automating the workflow to process "Dry" and "Wet" datasets simultaneously in a single loop.
Data Visualization & Verification: Plotting 3D surfaces to visually verify the engine envelope and ensure no data artifacts exist before simulation.
By the end of this video, you will have a clean, structured .mat database containing the exact Thrust and SFC maps needed to feed the Flight Dynamics Model we will build in the next sections.
In this lecture, we transition from relying on pre-made software (GasTurb) to building our own "White Box" propulsion model. We will be scripting the thermodynamic cycle of the J85-GE-5 engine from scratch using MATLAB.
We will focus on determining the performance characteristics for two critical engine operation modes for our T-38 physics engine:
Dry Thrust (Military Power): The baseline engine performance generated by the core turbomachinery (Compressor, Burner, Turbine) without reheating.
Wet Thrust (Maximum Power): The significant performance boost gained by activating the Afterburner/Reheat section, essential for supersonic flight.
What you will learn in this session:
Parametric Cycle Analysis (PCA): How to implement Mattingly's thermodynamic equations for Intake, Compressor, Burner, Turbine, and Nozzle components in code.
MATLAB Implementation: A step-by-step guide to scripting the Brayton Cycle, handling "Choked Flow" checks in the nozzle, and managing Bleed Air losses.
Afterburner Logic: Modeling the reheat phase to calculate the theoretical maximum thrust and fuel consumption (SFC).
Data Generation: Creating the 3-Dimensional Lookup Tables (Mach vs. Altitude vs. Thrust) that will serve as the "heart" of our full mission simulation.
By the end of this video, you will have a fully functional MATLAB script that generates the alternative engine performance data needed to power our Flight Dynamics Model in the upcoming simulation sections.
How do you get data from a picture into MATLAB?
In engineering projects, aerodynamic data often comes in the form of scanned plots or images inside PDF reports, not clean Excel files. In this Appendix-A lecture, we demonstrate the essential process of digitizing a graph.
We will:
Take a sample Lift and Drag Coefficient vs. Angle of Attack plot from an image source.
Extract the data points manually/digitally.
Re-plot the data in MATLAB to verify that our digital array matches the original curve perfectly.
This is a quick verification step to ensure the data we use in simulations is accurate.
Raw data is rarely simulation-ready. In this lecture, we tackle a common engineering problem: dealing with inconsistent aerodynamic datasets obtained from external sources.
We will see that raw data vectors often have mismatched ranges (e.g., different Mach number endpoints), which makes creating a standard 2D Lookup Table impossible.
In this session, we will:
Visualize the Problem: Load and plot raw .mat files to see the inconsistencies in the Drag-Due-to-Lift factor.
Harmonize the Data: Create a common Mach grid (0:0.01:1.2) for all datasets.
Implement "Safe Extrapolation": Write a smart MATLAB function using interp1 and fillmissing ('nearest') to prevent wild oscillations outside the data range.
Prepare for Lookup: Convert scattered data into a clean matrix format ready for interp2.
Note: The video focuses on the data processing logic. The final structure creation is included in the downloadable source code.
Stop solving textbook equations and start simulating real-world aircraft missions!
In this course, we bridge the gap between theoretical flight mechanics and modern engineering simulation. Designed for engineering students and aviation enthusiasts, this course guides you through the complete process of Aircraft Design & Analysis using a powerful trio of tools: OpenVSP, GasTurb, and MATLAB.
You won't just watch; you will build. We will take a real-world supersonic trainer (inspired by the Northrop T-38) as our case study and simulate its entire mission profile from the ground up.
What you will learn:
Geometric Modeling: How to model aircraft geometry and export aerodynamic stability data using OpenVSP.
Propulsion Analysis: Understanding engine maps, thrust tables, and fuel consumption behaviors using GasTurb.
Dynamic Mission Simulation: Bringing it all together in MATLAB to build a 3-DoF physics engine that simulates Takeoff, Climb, Cruise, Descent, and Landing.
Flight Control Systems: How to design and tune PID Autopilots for Altitude Hold, Auto-Throttle, and Automatic Landing (Flare).
Modular Design: How to create a flexible, professional-grade code framework that you can adapt for future aircraft projects.
Why this course? As an Aeronautical Engineer, I know that university theory often feels disconnected from practical application. Most courses teach you how to calculate Lift, but few show you how to code a simulator that flies. By the end of this course, you will have a working MATLAB framework capable of simulating complex flight missions with autopilot logic.