I would like to construct a histogram with unequal bins (intervals)..Matlab construct only histograms with equal bins as if it's a diagram..!!!
Please help me...thanks a lot!!
I would like to construct a histogram with unequal bins (intervals)..Matlab construct only histograms with equal bins as if it's a diagram..!!!
Please help me...thanks a lot!!
You could build your own histogram tool to create a custom histogram as you like.
Use histc to determine which bins each point falls inside.
Then use accumarray to count the number of elements in each bin.
Then use bar to draw bars of your chosen widths. Or simply create patches of the given sizes. Use patch for that.
Or more simply, just use hist.
hist(rand(1000,1),[0 .1 .3 .6 1])
Here's an example:
x = randn(100,1)*3; %# some random data
e = [-10 -5 -3 -1 1 2 3 20]; %# edges of intervals: e(i) <= x < end(i+1)
c = histc(x,e); %# get count in each interval
bar(e, c, 'histc') %# bar plot
set(gca, 'xlim',[e(1) e(end)])