A MATLAB and Simulink project focused on modeling and controlling a two-dimensional rocket using rigid-body dynamics, aerodynamic drag, and closed-loop PI control.
This project explores the modeling, simulation, and control of a two-dimensional rocket using first-principles physics.
The simulation was developed in MATLAB and Simulink to investigate how thrust, gravity, aerodynamic drag, and rotational dynamics influence rocket flight behavior. A PI controller is used to command the rocket toward a desired pitch angle while simultaneously modeling the vehicle's translational and rotational motion.
The rocket is modeled as a rigid body operating in two dimensions.
The simulation tracks:
- Horizontal position (x)
- Vertical position (y)
- pitch angle (θ)
The coordinate system is defined such that:
- Positive x points horizontally to the right
- Positive y points upward
- Gravity acts in the negative y direction
- θ = 0° corresponds to a vertically oriented rocket
- Positive θ is directed in the clockwise direction
The following assumptions are used throughout the simulation:
- The rocket is modeled as a rigid body with a uniform mass distribution.
- Structural flexibility and bending effects are neglected.
- Aerodynamic lift forces are neglected.
- Fuel consumption is not modeled; the rocket mass remains constant.
- The main thrust is assumed to be constant.
- The mass moment of inertia is approximated using a slender-bodied rod model.
For the simulated maneuver, the following conditions are assumed for
-
$x > 0$ ,$\dot{x} > 0$ -
$y > 0$ ,$\dot{y} > 0$ -
$\theta > 0$ ,$\dot{\theta} > 0$
| Parameter | Description | Value |
|---|---|---|
| Rocket Mass | 3000 kg | |
| Rocket Length | 15 m | |
| Rocket Radius | 0.25 m | |
| Main Thrust | 55,000 N | |
| Gravity | ||
| Drag Coefficient | 0.25 | |
| Air Density |
The rocket mass moment of inertia is approximated as:
The force configuration used in the simulation is shown below.
The rocket dynamics are derived using Newton's Second Law and rigid-body rotational dynamics.
where aerodynamic drag is modeled separately and applied opposite the vehicle velocity.
Aerodynamic drag is modeled as:
where:
- ρ = air density
- C_d = drag coefficient
- A = cross-sectional area
- v = vehicle velocity
And the cross-sectional area is approximated by:
A proportional-integral (PI) controller is used to regulate the rocket pitch angle.
The controller law is:
where the pitch angle error is defined as:
and:
-
$u(t)$ is the controller output -
$K_p$ is the proportional gain -
$K_i$ is the integral gain -
$\theta_{ref}$ is the desired pitch angle -
$\theta(t)$ is the current pitch angle
The controller continuously adjusts the thrust command to drive the rocket toward the desired angle reference.
| Parameter | Value |
|---|---|
| 30° | |
| 90 | |
| 12 |
The controller continuously adjusts the thrust response within the simulation to drive the vehicle toward the desired pitch angle.
| Variable | Value |
|---|---|
| 0 m | |
| 0 m | |
| 0 rad | |
| 0 m/s | |
| 0 m/s | |
| 0 rad/s |
| Parameter | Value |
|---|---|
| Final Time | 10 s |
| Time Step | 0.005 s |
The Simulink model numerically integrates the rocket equations of motion and implements the PI control loop used for pitch angle regulation.
The mathematical model was implemented in Simulink using:
- Integrator blocks
- Gain blocks
- Summation blocks
- Trigonometric functions
- Feedback control loops
The model computes:
- Position
- Velocity
- Acceleration
- Ptich angle
- Angular velocity
- Controller output
through numerical integration of the governing equations.
The rocket successfully increases the pitch angle while tracking the commanded angle reference, and the PI controller produces a stable response and gradually rotates the vehicle toward the desired 30° target pitch angle.
RocketSimulation/
│ README.md
│
├───docs
│ Project_Report.pdf
│ RocketSimulation_SimulinkModel.png
│
├───results
│ RocketSimulation_F1_response.png
│ RocketSimulation_theta_response.png
│ RocketSimulation_x_position.png
│ RocketSimulation_y_position.png
│
├───simulink
│ RocketSimulation_sim.slx
│
└───src
RocketSimulation.m
-
Full PID Control Implementation
- Add derivative control to improve controller response and reduce overshoot.
-
Fuel Consumption and Mass Depletion
- Model decreasing vehicle mass during flight to better represent real rocket behavior.
-
Real-Time Telemetry Dashboard
- Stream simulation data to a live dashboard for visualization and analysis.
-
Three-Dimensional Rocket Dynamics
- Extend the simulation to incorporate z-plane.
- MATLAB
- Simulink
- PI Control
- Numerical Simulation
- Dynamic System Modeling
Gabriel Sahlin
Bachelor of Science in Applied Mathematics and Computer Science with interests in modeling and simulation, aerospace systems, control theory, embedded systems, and software engineering.





