Académique Documents
Professionnel Documents
Culture Documents
Part A: Introduction
Fireworks have been around for hundreds of years. It all started when Li Tian, a Chinese monk,
stuffed a section of bamboo with gunpowder and lit it on fire. The loud bang was intended to
scare ghosts away.
While modern day fireworks have changed greatly, they are still composed of the basic elements:
a shell, an explosive, and a fuse. Scientists rely on a series of two reactions in order to get a
firework into the sky and exploded. It includes a fast-fuse and a slow-fuse traveling inside of a
long paper cylinder. At the bottom of the cylinder, the firework (an aerial shell) is placed on a
bed of gunpowder. The fast-fuse runs from the outside of the cylinder into the gunpowder. The
fast-fuse and short-fuse are lit at the same time; however, the first fuse works quicker to light this
gunpowder. Once the gunpowder is ignited, the unexploded firework shoots into the sky.
The inside of that firework is what will create the beautiful displays of color. An outer shell of
plastic or paper surrounds more gunpowder with explosive spheres (called stars) mixed
throughout it. The stars become the point of the firework we actually see. They are coated in a
variety of chemicals in order to create different colors.
Now that the firework is in the sky, it needs to explode. The second reaction involves the shortfuse running through the firework. The length is calculated in order to ensure the firework will
go off in the correct location in the sky. This fuse will set off gunpowder and stars located within
the actual firework, and the firework will explode.
Scientists can change the amount of gunpowder and type of fuse in order to include more noise
or create distinguishable shapes.
Source: http://www.theverge.com/2013/7/4/4489980/how-do-fireworks-work
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
2. Check to see if the user entered an incorrect value (i.e. X is a negative number). Use a
different while loop to check each variable.
3. Now plot the original starting location using asterisks (*). Add a title.
4. You will want your firework to all plot on the same graph. Therefore, add a hold on
command.
5. Add the following code in order to keep the plot the same dimension:
xlim([X-20 X+20]); ylim([Y-20 Y+20]);
6. Using a for loop for three iterations, plot the firework over time. After each iteration, the
stars should expand one more space. You should be able to see the stars path; therefore, add
the hold on command after each plot. In Part B, you only plotted diagonally. Here, you will
plot in eight directions: the four diagonal directions and up, down, left, and right.
HINT: Think of the relationship between the original plot point and the new plot point in
order to graph each star.
7. Add a count. You can use this variable to plot each point if you would like.
8. Within your for loop, you should also include the pause command. It will help you see the
firework explode and animate your plot. For example, pause(0.5) would pause the code for
0.5 seconds.
9. Plot your results for the final graphs below.
PLOT FOR X=25 AND Y=25:
PLOT FOR A POINT OF YOUR CHOOSING X=___ AND Y=____:
randi(250, 1, Number of Total Fireworks) will create a list of random numbers between 1
and 250. The list will be the same length as the number of total fireworks requested as long
as you use the same variable as your input statement.
4. Edit your xlim and ylim commands to take into account the new limits.
5. Create a new color each time you run your code. You can do this by adding C=rand(1,3)
before the for loop and initial plot. Within each plot command, you will also add the color
command and C as shown for the initial plot below:
plot(X,Y,'*','color',C);
TO BE TURNED IN: LAB WORD DOCUMENT WITH TABLES FILLED OUT AND
MATLAB CODE PASTED WHERE INDICATED.