MatlabHistFit-从数据中获取PDF,ksdensity?

MatlabHistFit-从数据中获取PDF,ksdensity?,matlab,plot,probability,histogram,Matlab,Plot,Probability,Histogram,我想用histfit从图中得到密度曲线方程 我知道使用密度函数可以得到点的向量。这是最好的方法吗 histfit(data); 将数据绘制为柱状图,并显示与其最匹配的平滑曲线 [mu, sigma] = normfit(data); pd = fitdist(data,'normal'); 将给出同一组数据的平均μ和标准偏差σ,histfit使用这些数据生成拟合曲线 如果确实编辑了histfit,您可以在其中查看,并通过将法线曲线下的区域与直方图中的区域相等来找到法线曲线的高度,查找周围的代

我想用histfit从图中得到密度曲线方程

我知道使用密度函数可以得到点的向量。这是最好的方法吗

histfit(data);
将数据绘制为柱状图,并显示与其最匹配的平滑曲线

[mu, sigma] = normfit(data);
pd = fitdist(data,'normal');
将给出同一组数据的平均μ和标准偏差σ,histfit使用这些数据生成拟合曲线

如果确实编辑了histfit,您可以在其中查看,并通过将法线曲线下的区域与直方图中的区域相等来找到法线曲线的高度,查找周围的代码

% Normalize the density to match the total area of the histogram
xd = get(hh,'Xdata');             % Gets the x-data of the bins.
rangex = max(xd(:)) - min(xd(:)); % Finds the range of this data.
binwidth = rangex/nbins;          % Finds the width of each bin.
area = n * binwidth;
y = area * pdf(pd,x);
有关执行该部分缩放的更多提示