A minimalist quadcopter model and hover simulation built in MATLAB/Octave, based on Francesco Sabatino’s master thesis at KTH. This project demonstrates the basic 6-DOF rigid-body dynamics of a quadrotor in free flight, focusing on attitude and position evolution over time.
Francesco Sabatino, “A Unified Approach to Quadcopter Control”, KTH Master Thesis, 2015.
📄 Download PDF
Matlab-Quadcopter-Dynamics-Simulator/
├── LICENSE # MIT License
├── pictures/ # Visual explanation
│ ├── control_input.jpg # Force/torque illustration
│ ├── figure1.jpg # Example position output
│ ├── figure2.jpg # Example orientation output
│ └── quad_equation.jpg # Dynamics equations
├── project/ # MATLAB source code
│ ├── quadvar.m # System parameters and initial conditions
│ ├── quadmodel.m # State update equations (Euler integration)
│ ├── quadrun.m # Main runner script (initialization + simulation)
│ └── quadplot.m # Plotting utility
└── README.md # Project documentation
The control input vector:
- u₁: total thrust
- u₂, u₃, u₄: roll, pitch, and yaw torques
These are derived from rotor speeds and used in the Newton–Euler equations to simulate translational and rotational motion.
- MATLAB R2018a+ or GNU Octave v4.0+
- No additional toolboxes required
- Add
/projectfolder to your MATLAB/Octave path
-
Clone or download the repo:
git clone https://github.com/2black0/MATLAB-Quadcopter-Dynamics-Simulator.git
-
Open MATLAB or Octave and set the working directory to
/project -
Run the simulation:
quadrun -
The script simulates 30 seconds of hover flight and saves two output plots:
figure1.jpg: position in X, Y, Z axesfigure2.jpg: orientation angles (Roll, Pitch, Yaw)
| Position (X, Y, Z) | Orientation (Roll, Pitch, Yaw) |
|---|---|
![]() |
![]() |
- Defines parameters: mass
m, arm lengthl, thrustb, dragd, inertiaI_x, I_y, I_z - Initial rotor speeds:
w1–w4(hover state) - Sets simulation time step and duration
-
Computes control inputs
u₁–u₄from motor speeds -
Applies Newton–Euler equations to update:
- Position (
x, y, z) - Attitude (
ϕ, θ, ψ) - Velocities and angular rates
- Position (
-
Euler method used for time integration
-
Main entry point:
- Initializes state
- Calls dynamics step for each frame
- Saves data and calls
quadplot
- Plots position and orientation versus time
- Saves figures to
figure1.jpgandfigure2.jpg
- 🧭 PID / LQR Control: Add a control law in
quadmodel.m - 🕹️ Trajectory Tracking: Define time-varying setpoints for position/orientation
- 🎥 3D Animation: Use
plot3orpatchto render quadrotor motion - 📓 Live Script: Convert to
.mlxfor interactive UI
This project is licensed under the MIT License.
Developed by Ardy Seto Priambodo ✉️ [email protected]
If you use this project in academic work, please cite:
@misc{matlab_quadcopter,
author = {Ardy Seto Priambodo},
title = {MATLAB Quadcopter Simulator},
year = {2023},
howpublished = {\url{https://github.com/2black0/MATLAB-Quadcopter-Dynamics-Simulator}},
note = {Based on Francesco Sabatino's thesis at KTH}
}Fly safely (virtually)! 🚁



