Probability Density Functions

advertisement
Histograms
Jake Blanchard
Spring 2010
Uncertainty Analysis for Engineers
1
Creating Histograms
Distribution functions are essentially
histograms, so we should get some
practice with histograms
 We’ll use solar insolation as an example

◦ Daily insolation averaged over a month
◦ Data is for Madison, WI
◦ Units are W-hr/m2
Uncertainty Analysis for Engineers
2
Small Set
Data on next slide is for January, years
1961-1966
 Divide results into bins
 Count instances in each bin
 Plot, usually with bar chart

Uncertainty Analysis for Engineers
3
January Insolation – 1961-1966
Year
Insolation (W-h/m2)
1961
1858
1962
1943
1963
2003
1964
1937
1965
1770
2050
2000
1950
1900
1850
1800
1750
1960
1961
1962
1963
1964
1965
1966
Uncertainty Analysis for Engineers
4
Categories
1700-1799
 1800-1899
 1900-1999
 2000-2099

1 entry
1 entry
2 entries
1 entry
3
2
1
0
1750
1850
1950
Uncertainty Analysis for Engineers
2050
5
Histogram for Full Data Set (Excel)
Uncertainty Analysis for Engineers
6
1250
1500
1750
2000
2250
2500
2750
3000
3250
3500
3750
4000
4250
4500
4750
5000
5250
5500
5750
6000
6250
6500
6750
7000
7250
7500
Excel

Go to Data/Data Analysis
 Then pick Histogram
35
30
25
20
15
10
5
0
Uncertainty Analysis for Engineers
7
Matlab
data=xlsread('histograms.xlsx');
 hist(data(:,2), 30)

40
35
30
25
20
15
10
5
0
1000
2000
3000
4000
5000
6000
7000
8000
Uncertainty Analysis for Engineers
8
Matlab

What if we just want the month by
month data?
7
7
6
6
5
5
4
4
3
3
2
2
1
1
0
1000
2000
January
3000
4000
5000
6000
7000
June
8000
0
1300
1400
1500
1600
1700
1800
1900
2000
2100
2200
January
Uncertainty Analysis for Engineers
9
Script
z=find(data(:,1)==1);
[N1,X1]=hist(data(z,2),10);
z=find(data(:,1)==6);
[N6,X6]=hist(data(z,2),10);
bar(X1,N1)
hold on
bar(X6,N6)
Uncertainty Analysis for Engineers
10
Download