Title: Chapter 5
1Chapter 56 Histograms Plots
2HistogramA frequency distribution shown in
graphical form.Frequency Number of times that
a data value occurs in the data set.
3Example of Frequency Distribution163 207 218 199
160 196 219 154 155158 180 178 157 151 175 201 18
3 153 174 154 190 200 186 174 199 193 167
171 163 176 181 160 194 184 165 160
150 181 168 158 208 162 171 166 170
180 167 176 158 156 154 158 150 169Interval Fr
equency150? x lt160 14160? x lt170 12170? x
lt180 9 180? x lt190 7190? x lt200
6200? x lt210 4210? x lt220 2
4Histogram Constructiongt Count the number of
observations (n)gt Find the largest smallest
valuegt Find the range (largest-smallest)gt
Determine the number and width of the class
intervals by the following rules
5Rulesgt Use from 5 to 20 intervals. ROT of
Intervals n1/2gt Choose the lower limit for the
first cell by using a value that is slightly
less than the smallest data value.gt The class
interval (width) can be determined by w
range/number of cells.
6Histogram Constructiongt Tally Data for each
Intervalgt Draw Rectangular Boxes with heights
equal to the frequencies of the number of
observations.
7Histograms Functions (MATLAB)hist(y) gtgtgt Plots
with 10 equally spaced
bins.hist(y,nbins) gtgtgt Plots with nbins
equally spaced bins.
8(No Transcript)
9(No Transcript)
10User-Defined FunctionsA type of M-file that runs
in its own independent workspace.function
output variables f_name(inputExample
variables)function
ksun(r,s) krsgtgtzsun(2,3)z 6
11 Example User Defined Functions Calculate
Distance between two points gtfunction
distancedist2 (x1, y1, x2, y2)
gtdistancesqrt((x2-x1).2(y2-y1).2)In the
program gtgtresult dist2(ax, ay, bx, by)
12(No Transcript)
13(No Transcript)
14Problem User-Defined FunctionsCreate a function
to calculate the kinetic energy of a moving
object KE ½ mv2