How can I use histfit and have the y-axis show frequency of data points in each bin and show the histogram as an outline?

8 views (last 30 days)
I am using the histfit function to get a histogram and a normal Gaussian fit of my data, but I would like it to show up as the relative frequency of points in each bin, rather than total data points in each bin on the y-axis, as well as it to show an outline of the histogram instead of bars. I have read that using "h(1)." will control the histogram without the fit, but I haven't been able to find a way to use this to create a relative frequency, or show just an outline (stairs) of the histogram. When using the histogram function, inputing "'Normalization','probability'" seemed to fix the frequency issue and "'DisplayStyle','stairs'" seemed to make an outline. Is there a way to do this in histfit? Thanks.
This is what I have regarding the histfit and histogram functions, where "x" and "x1" are different data sets:
figure(1)
clf
hold on
hd = histogram(x1,'Normalization','probability','DisplayStyle','stairs','LineWidth',2.5);
h = histfit(x,30,'normal');
hold off

Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!