MATLAB Homework 5: Exercise 5. 1 Load and Convert Data (2pts)
MATLAB Homework 5: Exercise 5. 1 Load and Convert Data (2pts)
Oke
CEE 260/MIE 273 Probability & Statistics in [Civil] Engineering 10.17.2019
Objectives
Practice loading data and computing summary statistics. Introduction to normal distribtuion
computation in MATLAB; plotting a normal distribution.
Prompt
The included CSV file contains the average construction duration (in months) of residential dwellings
in the United States from 1971 to 2009.
(a) Use the normfit function to find the estimated parameters (mean and standard deviation) of
the normal distribution fit to this dataset. Properly format your answer. (Do your results show
any similarity to the summary statistics?)
(b) Use the histfit function to display a histogram of the data and fitted normal probability
density function. (Be sure that you understand this plot. Observe that the y-axis values of the
histogram and curve do not coincide.)
(c) Now create your own density plot of the estimated normal distribution with the normpdf
function and your results from (a), using a reasonable x-axis range (a possible range has been
given in the template). Properly label both axes and title the plot. You may use plot arguments
such as ‘LineWidth’ and post-plot commands such as grid on to enhance your plot.
1
See note on fprintf vs. disp on Page 2.
Page 2 Oke
and
1 The s t a n d a r d d e v i a t i o n i s 1 7 . 3 7 days
One interesting feature of disp is that you do not need to end the text with the newline character
\n.
Submission instructions
Append your name to HW5.m with an underscore (deleting template from the filename). Note that
MATLAB filenames must begin with a letter and contain only letters, numbers and underscores.
Modify the template file as brutally as you wish, as long as your submission produces the required
output as specified in the Exercises. Before you submit, make sure that your .m file produces all
the required (properly formatted) output (including the plots).
Tip: To run your .m file from the MATLAB Command Window, simply enter the filename
(without the extension).