hi every body how can I represent the histogram of a data vector without using the hist function ? thanks
No products are associated with this question.
no what i mean that i dont want to represent it with bars but only line that represent the distribution of my data(in vector)
You would essentially have to program up the internals of the histogram function yourself. Very, very easy to do, once you've decided on your bin edge locations. Just think it through in your head and I'm sure you'll know what the code needs to be. It's fairly trivial, so you probably won't need any help.
X = randi(20,40,1); ii = [-inf 0:4:20 inf] out = sum(bsxfun(@lt,X,ii(2:end))&bsxfun(@ge,X,ii(1:end-1))) histc(X,ii)
THANKS andrei Bobrov for the response but i need not to use the histc function because i want to represent my data without bars only line
Is it that you just don't want the bar graph that comes up with HIST? If you call it with output arguments, you can get the values without the bar graph.
Then you can just plot those as a line.
data = randn(1,10000); [N,X] = hist(data,30); plot(X,N)
Play games and win prizes!Learn more