The document describes a project to simulate the flight parameters of a rocket using MATLAB and Simulink. Key assumptions made include treating the rocket as a point mass, neglecting lift forces, and assuming ideal atmospheric conditions. Thrust data was obtained from online databases. The simulation predicted altitude, velocity, acceleration, drag, and other parameters. Results showed reasonable trends but discrepancies of up to 40% compared to other simulation software, likely due to assumptions about drag being constant. Overall, the project provided a basic simulation of rocket flight within the constraints of limited time and resources.
An Unmanned Rotorcraft System with Embedded Design
AE30ProjectFIFIReport
1. Predicting Flight Parameters of a Rocket Using MATLAB and
Simulink
Edgar Aguilar, Stanley Krześniak, Taylor Nguyen, Michael Sandoval, and Scott Sherod
San José State University, 1 Washington Square, San José, CA, 95112
A method for predicting the velocity, acceleration, position, mass of rocket, dynamic pressure, and
total drag all with respect to time was developed using Simulink. Thrust information specific to a
motor was obtained from thrust curves based on prior testing from a thrust curve database.
Because of limited development time, flight is only predicted in ideal conditions - no wind and flight
and only along the Z-axis.
Nomenclature
v = velocity
a = acceleration
g = gravitational constant
_mpulseI otalt = total impulse
_ropellantP eightW = weight of propellant
_ngineE eightW = total weight of solid rocket engine
_urnoutB assM = weight of rocket after consuming propellant
_ragD oefficientC = coefficient of drag
_ocketR iameterD = diameter of rocket
ρ = density of air
A = cross sectional area of rocket
q = dynamic pressure
M = Mach number
eR = Reynolds number
a = speed of sound
T = temperature
P = air pressure
H = height of altitude
2. 1. Introduction
Predicting flight characteristics of a rocket before assembly or flight is extremely important,
especially in space-capable rockets. Parameters such as lift (in crosswind launches), parasite drag,
induced drag, maximum payload, change of center of thrust, center of drag, and center of mass, and more
are extremely important to take into consideration, especially the larger and higher the rocket is rated to
fly. For as long as rocketry and computers have existed, simulation and prediction of rocket flight
including as many parameters as possible in six degrees of freedom have existed. Because of the limited
amount of computational power at the turn of the rocket age, rockets were tested in wind tunnels, data
was gathered on scaled down models, and assumptions on many variables were made. Today, with far
superior computing power, scaled down models are almost unnecessary, and nearly every imaginable
variable and force and environmental factor can be incorporated into the computed flight model of a
rocket.
Because there are so many variables and factors, there is a proportionally large field of research in
predicting flight characteristics of ballistic objects, like missiles and space-capable rockets. As we only
had roughly two-thirds of a semester to complete our project, our project and methodologies minimally
contribute to this vast field. We had to make several assumptions, most significantly drag, which
decreased our accuracy based on results from other professional and proven simulation software. Since
the rocket is small [1] in comparison to rockets in the current literature, we opted to simulate rocket flight
in only the Z-axis. Despite the fact that the Project FIFI rocket is small, this decision to simulate in only
one degree of freedom further degrades the accuracy of the simulation. The vast majority of simulations
in the current literature are conducted in 3 degrees or 6 degrees of freedom. [5][6][8]
The paper “Six-Degree-of-Freedom Digital Simulations for Missile Guidance, Navigation, and
Control” [6] provide a detailed history of methodologies of simulating missile GNC (guidance,
navigation, and control) as well as a deep investigation about the methodologies themselves. FORTRAN
was used extensively because of the high-quality mathematics libraries, but was later phased out because
of an issue called “spaghetti code” - code that is extremely difficult to follow due to GOTO function calls
and other structures. Code was then written in C, C++ and Java, and made high fidelity simulations
possible, describing systems as nonlinear differential equations, partial differential equations, and
discrete-time equations used in nearly all methodologies today.
In “Flight characteristics of a rocket under various environmental conditions” [7], Tashiro
discusses methods of factoring wind and other variable environmental factors into calculations. His study
3. concluded that “wind effects of rocket during burning could be able to compute introducing an empirical
factor into the equations of motion as particle [sic]” (996).
In “3-DOF Longitudinal Flight Simulation Modeling And Design Using MATLAB/Simulink”
[5], Ahmed uses Simulink and its various blocksets to create an accurate model of flight when linked with
the equations of motion. MATLAB was also used to linearize the equations of motion as well as provide
an interface between Simulink and the model of the aircraft generated using MIT’s Athena Vortex Lattice
program.
In the paper “Stochastic Six-Degree-of-Freedom Flight Simulator for Passively Controlled
High-Power Rockets” [6], Box, Bishop, and Hunt developed a method that determines the flight path of a
model rocket, particularly for rockets of Level 2 certification range all the way from launch to landing
including the simulation of a parachute landing. The simulation uses a Monte Carlo method of
randomizing wind conditions, and results in an extremely accurate simulation when compared to
experimental data. 4th and 5th order Runge-Kutta-Fehlberg methods were used to integrate the rocket
equations of motion over time, also resulting in a high-fidelity simulation.
The information found in “Emulation of Rocket Trajectory Based on a Six Degree of Freedom
Model”[8] described a modular design of using subsystems to enhance the usability of a Simulink
workspace by introducing subsystems. By introducing subsystems, the Simulink workspace is greatly
improved as it is much easier to understand and follow. The visual references to mathematical modeling
allows further understanding of complex systems and how they work together.
2. Problem Description
Assumptions and Conditions:
The problem we undertook in this project was creating MATLAB code that can calculate
aerodynamic forces and output useful graphs that the senior team could use to make adjustments
to their rocket. For example, one of our goals was to output an altitude graph. With that graph the
senior team would know their max altitude and if they would over/undershoot their one mile
mark. We had to make assumptions to make the code simple, because a majority of our team
have not taken vector dynamics which would have made the code very precise. In the future, we
plan to improve the code and Simulink to be more realistic than it is now. We assumed the rocket
as a point mass, mainly because we did not have the dimensions of the rocket from the senior
4. team. If we had this information, we could've calculated center of gravity and center of pressure,
but we neglected these as well. We did not use atmospheric data from the launch site, Huntsville,
Alabama, instead we made the assumption of an idealized atmospheric model. Some variables
were kept constant such as: drag coefficient, reynolds number, temperature, gravity, and
diameter of the rocket. The code does not take into account lift force because we assume the
rocket is not launched at an angle.
Free Body Diagram:
Set-up:
To set up our code, we set up our initial variables such as:
● Total impulse
● Burnout mass
● Propellent weight
● Engine weight
● Gravity
● Air density
● Rocket diameter
● Drag coefficient
5. There were too many variables that changed with time, and we did not have enough
information to find the thrust through calculations, so we used a thrust curve from
thrustcurve.org [10] and made a vector of all the thrust forces at specific points in time. From
there we created the Simulink model that combines the thrust force, weight force, and drag force.
Outputs:
As previously mentioned, we wanted to output graphs that would give useful data for the
senior design team. Therefore we had the code output graphs of:
● Acceleration
● Velocity
● Drag
● Dynamic pressure
● Altitude
● Propellant mass
● Mach number
Expected Results/Outcomes:
We expected our results to not be as accurate as the senior team’s RockSim data. We also
knew that our drag would be extremely off because we assumed that the rocket had a constant
drag coefficient, but in reality it changes as velocity changes. However, most of our graphs
provide useful data and are some are very close to the data from RockSim.
3. Solution Methodologies
Since this was a class project we were limited as to what ways we could go about finding
solutions to our mission statement. Our main two ways were to either use MATLAB or
SimuLink, or both. During the very early weeks of our project we stuck with MATLAB and
6. found ways using very large row vectors to store flight data every millisecond of flight time.
This method, although extremely effective, proved to be extremely difficult for us. Our main
problem was finding an accurate and reliable representation of thrust. The senior team was using
an Aerotech L850W rocket propellant [10] (all specifics to the propellant can be found in the
senior team’s project proposal), we took the motor data of the propellant they were using and put
all of that information into a website called Thrustcurve.org. Thrustcurve.org gave us a plot of
the thrust over Time, and specific Thrust values at random timestamps from when the rocket was
launched to motor burnout. The problem with this Thrust table was that the time intervals were
random and the Thrust at each second throughout the flight was not known which would lead to
inaccurate calculations of thrust in our MATLAB script.
To get rid of some of these errors that were encountered when calculating thrust we tried
doing a curve fit of the graph given to us by thrustcurve.org, this gave us a 6th degree
polynomial equation with an R-squared value of about 0.8967. We stuck with this method up
until the last couple of weeks of the project. Around this time we began to look at Simulink as a
way to model the flight parameters of our rocket. After doing research on Simulink we found
some example codes that were using the same Thrust vs. Time tables we got from
thrustcurve.org but instead of using curve fits like we did they used graphical interpolations in
between the time intervals to approximate the unknown values of Thrust. After discussion with
the group we all agreed to switch to Simulink as it provided us with a much more accurate and
reliable representation of Thrust. Below is a screenshot of our Simulink Model.
7. Fig 3.1: The Simulink main workspace
The model starts on the left with all of our forces acting on the rocket: Thrust, Drag, and
Weight. The mass of the rocket comes from the Thrust workspace and is multiplied by a gain
which we named “g” for gravity. All the forces are then summed and that sum is divided by mass
to obtain our acceleration. An integrator is used to integrate acceleration and obtain velocity
which then branches out into our calculations for Drag, Mach Number, and Dynamic pressure.
Another integrator is used to find our flight trajectory or maximum altitude which branches out
into our calculations for the Atmospheric model which in turn indirectly calculates Dynamic
Pressure, and Mach Number, and also Drag. Every parameter we calculate also branches out into
their respective scopes so that flight data can be plotted over time.
The model uses four different workspaces: Thrust, Drag, Dynamic Pressure, and Mach
Number. Each of these parameters have their own set of calculations for their workspaces. The
below figures display the models used to calculate these four parameters.
8. Fig 3.2: SimuLink Thrust Workspace
The model starts on the left with a clock to show that Thrust is a function of time. The
next section titled “Thrust Curve” is where we inputted our Thrust vs. Time tables and where all
the graphical interpolation and approximation occurs. It is that function alone that made the
SimuLink model more efficient than any MatLab script we could come with. After it
approximates Thrust those values are inputted into the master workspace. The model then uses
an integrator to integrate our Thrust curve and output the Burned Impulse which is then divided
by the total impulse of the propellant which we obtained from data given to us by the Senior
Team. This calculation of “Burned Impulse”over “Total Impulse” gives us the ratio of the fuel
burned at a specific time during flight. Multiplying this ratio by propellant weight gives us the
weight of propellant burned at that specific time. The model then subtracts that value from the
Engine weight to get the total weight of the engine at that time. This value is then added to the
mass of the rocket at Motor Burnout to find the total mass of the rocket at any specific time.
9. Fig 3.3: The Drag Workspace
Drag was fairly simple since we assumed it to be constant over the duration of the flight.
The calculation starts on the left with an input of Density from the atmospheric model block, the
velocity which we get from integrating our acceleration, our drag coefficient, and other constant
values such as rocket diameter. These are all multiplied and divided by 2 to get our Drag over the
course of flight. The one interesting thing to point out for this calculation is the block that says
“sign”. The velocity is squared in the calculations for drag so to preserve the sign of our Velocity
we included that sign block to preserve our negative sign when needed.
10. Fig 3.4: Mach Number and Dynamic Pressure Workspace
Above are the workspace for Mach Number and Dynamic Pressure. Mach Number is
found by taking the velocity of an object and dividing that by the speed of sound. The velocity
comes from integrating our acceleration and the speed of sound comes from our altitude and
atmospheric model. It then outputs our mach number over time. Dynamic pressure is calculated
by the equation (q=dynamic pressure) . The velocity comes from integrating ourvq = ρ 2
acceleration and the density again comes from the atmospheric model. These are all multiplied to
output the dynamic pressure over time.
We also used MatLab in addition to SimuLink, however, the MatLab script was just to
define variables such as gravity, mass of rocket after motor burnout, air density, drag coefficient,
etc. Below are screenshots of our MatLab Script.
11. Fig 3.5: MatLab Script, Constants Defined, Thrust and Time tables.
Fig 3.6: MatLab Script, Output Plots.
The script first defines constants and uses them in the SimuLink model. The script then
defines our Thrust vs. Time tables for our thrust calculations in Simulink. The script then calls
12. the SimuLink model and then outputs plots for acceleration, velocity, altitude, thrust, mass, drag,
dynamic pressure, and mach number. All codes can be seen in the attached code folder.
4. Results and Discussion:
The maximum altitude found by the integration from the velocity in our Simulink model was
1746 m where the presented RockSim data was found to be 1889 m [9]. This results in a 7.53%
discrepancy. The plot of altitude vs time looked to have an appropriate trend, as the trajectory was fairly
parabolic as in Figure 4.1. This leads to the conclusion that the velocity of the rocket was not changing
rapidly, as it most likely would in a real world scenario considering the assumption that we did not model
a parachute.
Figure 4.1: The Altitude as a function of time.
The maximum mach number of 0.52 was calculated with the mach number subsystem in
Simulink by whereas RockSim yielded 0.58 [9], which translated to a 10.6% discrepancy. As seen in Fig
4.2, the Mach number plot increased during roughly the first 3 seconds in which the thruster was active.
After burnout of the propellant occurred, the mach number decreased with time in a linear fashion. This
result is appropriate because the only forces we took into account were the force of thrust, drag, and
gravity.
13. Figure 4.2: Mach number as a function of time.
The maximum velocity which was integrated from the acceleration to be 175.9 m/s with
Simulink, and RockSim yielded 197.45 m/s [9] which resulted in a 10.9% discrepancy. The velocity
graph is similar to the Mach number graph above and yields appropriate trends for it is dependent on
velocity. However, the maximum value is dependent on drag which we assumed a constant whichCd
would make sense that the maximum value Simulink calculated, is less.
Figure 4.3: Velocity as a function of time.
The maximum acceleration during the course of the flight was calculated to be 74.98 m/s^2 as to
the 125.69 m/s^2 that RockSim calculated [9[. This resulted in a 40.4% discrepancy. The trend that the
acceleration shows in Fig. 4.4 is appropriate as the acceleration is maximum between zero and three
seconds, and then transitions to a constant -9.8 .This error in the maximum values can also be/sm 2
contributed to the assumption of a constant coefficient of drag as when we assumed the coefficient of drag
to be constant, it would have a large effect on decreasing the acceleration when the engine is producing
thrust.
14. Figure 4.4: Acceleration as a function of time.
Max q or dynamic pressure that was calculated was 18.4 KPa as seen on Fig 4.4. STAR-CCM+
found a value as illustrated in Fig. 4.5 of about 14 KPa on gage pressure [1]. This results in a 31%
discrepancy. Our simulink model used a COESA-extended standard atmospheric density function that
varied with altitude. The COESA-extended U.S standard atmosphere model was chosen because it is valid
within our parameters of altitude[3]. This may have been a possible contribution to the error as RockSim
may use a different models of air density as well as the assumption of a constant coefficient of drag.
Additionally, the maximum dynamic pressure started to rise again after apogee as the rocket started
accelerating in the negative direction, which makes sense because we did not consider a parachute in our
model.
Figure 4.4: Dynamic Pressure as a function of time.
15. Figure 4.5: STAR-CCM+ Gauge Pressure on rocket, refined mesh
The Simulink model that we generated found the maximum drag to be 30.49 N at a time of about
3 seconds which correlates to the time that we have maximum acceleration. In our Simulink model we
assumed the drag coefficient to be a constant value of 0.204026 based on preliminary calculations
performed by the senior team[1]. It was chosen to consider this value a constant because the true
modeling of the coefficient of drag is something that we could not include in our Simulink model within
the allotted time due to limited knowledge about boundary layers. It is important to note that drag
calculations are typically used as a rule of thumb as it is experimentally determined through the use of test
flights.
Figure 4.6: Drag as a function of time.
16. Figure 4.7: RockSim Drag monitor.
The results that we found made sense within the conditions that we assumed. Because we
assumed the coefficient of drag to be constant, it could be concluded that the maximum altitude, velocity,
acceleration, and mach number would be of lesser values than the ones found with RockSim. It is also
reasonable that the total drag and maximum dynamic pressure would also be greater due to our
assumptions.
Our solution methodologies progressed over the course of the project. In the beginning we
decided on a 3 degrees of freedom rocket trajectory. Unfortunately, it was quickly apparent that our team
lacked the knowledge of how to properly apply our current tools to model a varying thrust. We failed to
model thrust with the tools and ideas that we came up with such as Microsoft Excel. Because of the
research we had done, we believed that we needed to use the exhaust velocity to model the flight of the
rocket as a function of time using the Tsiolkovsky Rocket Equation. We found no support finding this
velocity, and additionally, we later found out it is not necessary. We found research articles such as
“3-DOF Longitudinal Flight Simulation Modeling And Design Using MATLAB/SIMULINK” [5] that
17. use a thrust table to interpolate the data to use directly. This was a huge breakthrough as it used precisely
the same information that we needed, and showed us how to apply it.
The model that we created in Simulink was the saving grace of this report as it worked well. It
was able to give us a small sense of accomplishment as it did predict the trajectory of the rocket, even if it
was not as precise as we would have liked it to be. When we tried to model the trajectory in three, and
two dimensions, we ran into numerous problems such as how to create equations of motion for a three
degree of freedom rocket. After struggling to derive the dynamic equations of a three degrees of freedom
rocket, we ran into troubles modeling the thrust of the rocket. One of the things that did not work well
was the approximation of the thrust with a polynomial. When we tried to use the thrust data within
Microsoft Excel to model the velocity of the rocket we failed to determine a way to accomplish a time
varying thrust. Calculating the drag was also did not go well as we found that the coefficient of drag is a
dependent variable and did not know how to calculate it for a 1-D trajectory.
We chose Rocksim as a benchmark to compare our data to as our senior design team used it to
design their rocket. It is also known as one of the leading rocket simulation programs available to
purchase as large model rocket companies such as Estes, Aerotech, and Cesaroni use it to design the
rockets that they manufacture. [4]
Our results are significant because they show that modeling a rocket with a constant drag
coefficient can have some value. This conclusion is reached because the discrepancy between the
generally accepted Rocksim altitude and our data is 7.5% different[9]. This value is not precise enough
for technical real world flights, but it is adequate to get an idea of the rockets proposed trajectory for
initial design considerations.
Our results do not contribute to existing literature. The current literature covers everything that
we have presented in our report.
5. Conclusions and Recommendations
Our objective was to assist the senior team with their rocket launch by simulating the rocket
acceleration, air drag, altitude, velocity, thrust, dynamic pressure, propellent mass, and mach number
using MATLAB and Simulink. The goal was to design a program that would accurately simulate these
parameters so that the senior team had a second tool at their disposal to cross reference with the data from
their Rocksim simulation.
With very basic knowledge of MATLAB and Simulink we were able to successfully simulate our
proposed parameters. Using the Project FIFI launch proposal, the rocket engine, height, and diameter
18. were obtained. Visiting the rocket manufacturers website we obtained the rocket thrust data, propellent
weight, engine weight, and total impulse. The thrust data included values of thrust at various moments of
time. This information was then used in MATLAB and Simulink to simulate the rocket flight parameters.
The MATLAB script sends the data to Simulink which then simulates the rocket parameters. Finally the
data from the Simulink simulation is plotted and outputted by MATLAB for the user to see. With the
exception of our acceleration, our simulation data came within 10% of their Rocksim data [2].
Learning Simulink was both our biggest challenge and also our biggest takeaway from this
project. Prior to this project each team member had only used Simulink once. Using the help tools
provided by Simulink and through numerous trial and error we were able to overcome this challenge. In
the process, however, we learned how valuable of a tool Simulink can be. By being a visual program that
operates by connecting the various blocks provided by Simulink, it limits the amount of typographical
errors often caused by traditional programming. This alone makes Simulink an invaluable tool for
programming beginners.
Our program successfully outputs the various parameters from our objective. Improvements,
however, can be made on the MATLAB portion of the program. In its current state it will only simulate
the flight parameters of the Project FIFI rocket. Ideally we would make the MATLAB script prompt you
for the rocket engine type and dimensions so that the Simulink model outputs the parameters of that
specific rocket. Additionally, the current MATLAB code is written in one script. This script can be
broken up into three functions in order to make the program look cleaner. One function to get the user
inputs, a second one to run the Simulink model, and the third one to plot the data from the Simulink data.
19. 6. References
[1] Bohrer, T., Humphries, T., Hendricks, T., Eckert, A., Israel, R., Johnson, P., Zigler, R., Dormody, K.,
and Martinez, M., “2016-2017 NASA San Jose State University Student Launch Project Proposal,”
Aerospace Engineering, San Jose State University, San Jose, CA, 2016.
[2] Bohrer, T., Humphries, T., Hendricks, T., Eckert, A., Israel, R., Johnson, P., Zigler, R., Dormody, K.,
and Martinez, M., “2016-2017 NASA San Jose State University Student Launch Preliminary Design
Review,” Aerospace Engineering, San Jose State University, San Jose, CA, 2016.
[3] National Oceanic and Atmospheric Administration, et al. U.S. Standard Atmosphere, 1976.
[4] "RockSim Information." Apogee Componets, www.apogeerockets.com/RockSim/
RockSim_Information#why_rocksim. Accessed 12 Dec. 2016.
[5] Ahmed, Umair. 3-DOF Longitudinal Flight Simulation Modeling And Design Using
MATLAB/SIMULINK.
[6] Box, Simon, et al. "Stochastic Six-Degree-of-Freedom Flight Simulator for Passively Controlled
High-Power Rockets." Journal of Aerospace Engineering, Jan. 2011.
[7] Tashiro, Yutaka. “Flight characteristics of a rocket under various environmental conditions” SPIE
Journal, vol. 348, 1982.
[8] Wenpeng, Zhang, et al. "Emulation of Rocket Trajectory Based on a Six Degree of Freedom Model."
Seventh International Symposium on Instrumentation and Control Technology: Measurement
Theory and Systems and Aeronautical Equipment,, vol. 7128, no. 71282H, 2008. SPIE Digital
Library, doi:10.1117/12.806878. Accessed 13 Dec. 2016.
[9] Bohrer, T., Humphries, T., Hendricks, T., Eckert, A., Israel, R., Johnson, P., Zigler, R., Dormody, K.,
and Martinez, M., “Milestone Review Flysheet” Aerospace Engineering, San Jose State University, San
Jose, CA, 2016.