
% this program is used to fit normal distribution to a histogram

load m26r6ws % load data (9000*6)

nb=50;
[N,x]=hist(windspeed(:,1),nb); % obtain data at 160 ft for the histogram

mean160=mean(windspeed(:,1));
std160=std(windspeed(:,1));

y=normpdf(x,mean160,std160);
y1=y*((max(x)-min(x))/nb);

plot(x,N/9000)
hold on
plot(x,y1,'-r')
title('Compare the pdf of the data to normal distribution')
legend('PDF of the data','Normal pdf')
hold off
