Download presentation
Presentation is loading. Please wait.
Published byStephanie Dean Modified over 8 years ago
1
Chapter 5&6 Histograms Plots
2
Histogram A frequency distribution shown in graphical form. Frequency: Number of times that a data value occurs in the data set.
3
Example of Frequency Distribution 163207218199160196219154155 158180178157151175201183 153 174154190200186174199193167 171163176181160194184165160 150181168158208162171166170 180167176158156154158150169 IntervalFrequency 150 x <16014 160 x <17012 170 x <180 9 180 x <190 7 190 x <200 6 200 x <210 4 210 x <220 2
4
Histogram Construction > Count the number of observations (n) > Find the largest & smallest value > Find the range (largest-smallest) > Determine the number and width of the class intervals by the following rules:
5
Rules > Use from 5 to 20 intervals. ROT: # of Intervals = n 1/2 > Choose the lower limit for the first cell by using a value that is slightly less than the smallest data value. > The class interval (width) can be determined by w = range/number of cells.
6
Histogram Construction > Tally Data for each Interval > Draw Rectangular Boxes with heights equal to the frequencies of the number of observations.
7
Histograms Functions (MATLAB) hist(y) >>> Plots with 10 equally spaced bins. hist(y, nbins ) >>> Plots with nbins equally spaced bins.
10
User-Defined Functions A type of M-file that runs in its own independent workspace. function [ output variables ]= f_name( input Example: variables ); function k=sun(r,s) k=r*s; >>z=sun(2,3) z= 6
11
Example User Defined Functions Calculate Distance between two points: >function distance=dist2 (x1, y1, x2, y2); >distance=sqrt((x2-x1).^2+(y2-y1).^2); In the program: >>result= dist2(ax, ay, bx, by);
14
Problem: User-Defined Functions Create a function to calculate the kinetic energy of a moving object: KE = ½ mv 2
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.