How to make a distribution from array

16 views (last 30 days)
Stefano Righi
Stefano Righi on 31 Jul 2017
Edited: José-Luis on 1 Aug 2017
Hey everybody, I'm pretty new in Matlab and english is not my mother tongue, so please be very patience.
I really would like to plot and array vs his occurrences. For example, I've got this array:
T = [2,2,3,4,5,5,5,12,34,11,11]
I'd like to plot this points: A(2,2) B(3,1) C(4,1) D(5,3) E(12,1) F(34,1) G(11,2)
I don't want to make an histogram, I would like to plot points and then fit them with the best fit. How can I do?
Thank you very much.
  2 Comments
Guillaume
Guillaume on 1 Aug 2017
I'd like to plot these points ... I don't want to make an histogram
These points are the exact definition of an histogram.
José-Luis
José-Luis on 1 Aug 2017
Edited: José-Luis on 1 Aug 2017
Do you mean you want to plot your histogram as a line and not as a bar plot? But as Guillaume has said, it would still be a histogram.

Sign in to comment.

Answers (1)

Akira Agata
Akira Agata on 1 Aug 2017
Plotting histogram and obtaining its bin counts are simply done by histogram and histcounts functions, respectively, like:
T = [2,2,3,4,5,5,5,12,34,11,11];
% Plot histogram
histogram(T);
% Obtain histogram bin counts
bins = histcounts(T);

Community Treasure Hunt

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

Start Hunting!