How to Normalize a Histogram without using fitdist and pdf or any other fitting functions?
5 次查看(过去 30 天)
显示 更早的评论
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;
data1 = load('343E_SCX_0p001-deviations.csv'); %343 Grain
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
0 个评论
采纳的回答
the cyclist
2021-9-6
Use the 'Normalization' Name-Value pair to the histogram function:
x_values = 0:0.01:5;
xx_values = 0:0.01:5;
data1 = load('343E_SCX_0p001-deviations.csv'); %343 Grain
len=length(data1);
limit=len/2+1;
StnDev1=reshape(data1(10,3:limit),len/2-1,1);
histogram(StnDev1,'Normalization','probability')
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Probability Distributions 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!