# How to Normalize a Histogram without using fitdist and pdf or any other fitting functions?

1 view (last 30 days)
Jacob Weiss on 6 Sep 2021
Commented: Jacob Weiss on 6 Sep 2021
I am trying to create a histogram for a set of data that is normalized, i.e the sum of the bins or area under the curve is = 1. However, fitdist or histfit apply a fit and does not simply normalize the curve. Attached are two images. The first is the histogram I need to normalize, and the second immage is the histogram when I use fitdist. I need to insure that the histogram has a total area of 1 without using a fitting function that will manipulate the actual data. How do I nomalize the data without changing/fitting its acual values?
x_values = 0:0.01:5;
xx_values = 0:0.01:5;
len=length(data1);
limit=len/2+1;
StnDev1=reshape(data1(10,3:limit),len/2-1,1);
StsDev1=reshape(data1(10,limit+1:end),len/2-1,1);
pd = fitdist(StnDev1,'Normal');
y = pdf(pd,x_values);
%histogram(StnDev1);
plot(x_values,y,'b','LineWidth',2)
hold on

the cyclist on 6 Sep 2021
Use the 'Normalization' Name-Value pair to the histogram function:
x_values = 0:0.01:5;
xx_values = 0:0.01:5;
len=length(data1);
limit=len/2+1;
StnDev1=reshape(data1(10,3:limit),len/2-1,1);
histogram(StnDev1,'Normalization','probability') Jacob Weiss on 6 Sep 2021
Thank you!