Hi Katherine,
I understand that you are facing an issue related to using bin edges instead of bin counts while using the function 'histfit'.
I am assuming that ‘hisfit’ mentioned in the legend refers to the data in ‘KT.mat’. You can try the following work around to specify bin edges. It involves fitting the data using Curve Fitting Toolbox as shown below:
SIG = 1.95;
MU = 5.5;
X = randn(100,1)*SIG + MU; % Replace it with the data in KT.mat
% Define the bin edges you want
EDGES = [1:0.5:10];
% Bin the data according to the predefined edges:
Y = histcounts(X, EDGES);
% Fit a normal distribution using the curve fitting tool:
binCenters = conv(EDGES, [0.5, 0.5], 'valid'); % moving average
[xData, yData] = prepareCurveData( binCenters, Y );
ft = fittype( 'gauss1' );
fitresult = fit( xData, yData, ft );
disp(fitresult); % optional
% Plot fit with data (optional)
figure();
histogram(X, EDGES); hold on; grid on;
plot(fitresult);
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1550297/image.png)
You may refer to the attached documentation to learn more about Curve Fitting Toolbox:
Hope this helps,
Regards,
Neelanshu