Download as pdf or txt
Download as pdf or txt
You are on page 1of 2

PHY 3010 Lab activity 2 of 4/7/24

Monte Carlo Simulation in Excel

Basic Steps (the numbers are general steps, and the sub-bullets are how they are applied to
our particular example):

1. Calculate the Mean and Standard Deviation of all your measurements as outlined in
a previous section.
o In our case, these are radius and height.
2. Set up column headers for trial and for each measurement and the final calculation.
o In our case, these are: Trial, Radius(cm), Height(cm), Volume(cc).
3. Now we are going to use NORMINV to pull random measurements from a normal
distribution.
o In our case, for the first row, enter “1” under Trial. Under Radius(cm), type
“=NORMINV(RAND(), [value of mean radius], [stdev. of radius])”. Under
Radius(cm), type “=NORMINV(RAND(), [value of mean height], [stdev.
of height])”.
o This will pull numbers from a normal distribution.
o By [value of mean radius], we mean the number.
o It is important that we hard code (type in) the value here, rather than just
click on the cell that is occupied by this value.
 This is because ultimately we will have very many trials, and we
would like to drag our formulae down for each trial. We learned
previously that when we drag formulae that has a cell(D2 or B4
for example) used in its equation in Excel Sheets, the cell changes
rows or columns when we drag through rows or columns
respectively.
4. Now code up your calculation
o In our case, for the first row, under Volume(cc), use an equation (V=πr2h)
to solve for volume using the radius and height from Trial 1.
o For this column, we do not want to hard code in the values for radius and
height.
 This is because we do want the radius and height to change for
each calculation; Trial 1 uses the first radius and the first height,
Trial 2 will use a new second radius and second height.
5. Run a lot of trials.
o In our case, we ultimately we will have 3000 trials, and thus 3000 rows.
For this to be an easy process, we want to be able to highlight a row, and
use the plus tool to drag it from Trial 2 all the way down through 2998
cells to Trial 3000.
o Our Radius(cm), Height(cm), and Volume(cc) are already set up to do this.
 Radius and height vary with every row, as RAND() takes a new
random value every time it is used.
 Volume varies with every row, as it depends on each trial’s radius
and height.
 All that we have left to set up is our trials such that they
increment by one for every row we drag down to.
 `In the second row, under Trial, type “=1+[click cell in
first row under Trial]”.
 After you hit enter, the cell should read “2”.
6. Use the plus tool to drag each measurement and your final calculation down to the
second row (Trial 2).
7. Highlight the whole second row, from “2” and use the plus tool to drag all the way
down through all of your trials.
8. You should now have many results of your calculation. You can calculate the mean
and standard deviation of these to arrive at your final result.
9. Follow the steps in the following link to generate the data for the normal
distribution of the volume

Plot the Normal Distribution in Excel with Mean and Standard Deviation
(exceldemy.com)

10. Plot the normal distribution graph

You might also like