%HISTOGRAM PDF PROGRAM %Developed by Larry S. Liebovitch %Florida Atlantic University %777 Glades Road, Boca Raton, FL 33431 %liebovit@fau.edu, 561.297.2239 %These programs have been tested and found to be accurate on a number of %different data sets, we do not guarantee that they will be accurate on %all data sets. The user assumes any risk involved in the use these %programs. %MATLAB (R2008A, 7.6.324) PROGRAM: pdfhist %Produces a Fixed Bin Size Histogram Probability Density Function (PDF) % clear format long filename=input('Type file name ','s'); fid=fopen(char(filename)); data = fscanf (fid, '%g',[inf]); size12=size(data); ptotal=size12(1) ntotal=0; smallest=min(data); largest=max(data); d1=input('smallest bin size (0=the program decides)'); if d1==0 d1=2*smallest; end kend=ceil(largest/d1)+1; kend1=kend+1; d=d1; ntotal=0; pin=0; pout=0; bin=(1:kend)*0; lbin=(0:kend)*d + d/2; for i2=1:ptotal k=fix(data(i2)/d)+1; if (k>=kend1) bin(kend1)=bin(kend1)+1; pout=pout+1; end if (k0; ntotal=ntotal+1; x(ntotal)=lbin(i3); y(ntotal)=bin(i3)/(d*ptotal); z(ntotal)=bin(i3); end end %i3 output(1,:)=x; output(2,:)=y; output(3,:)=z; toutput=output' %data inputfilename=filename outputfilename=strrep(inputfilename,'.','HISTPDF.') Datafid = fopen(outputfilename,'w'); fprintf(Datafid,'%16.8g \t %16.8g \t %16.8g \n',output); fclose(Datafid);