Problem plotting with bar() instead of hist()
3 views (last 30 days)
I use this code to overlay a CDf plot on a histogram. Note the histogram data in binned according to bin centers.
bin = 110:10:220;
[y2,x2] = ecdf(y);
[y1,x1] = hist(y,bin);
However, I need to bin the data using bin edges instead. I have tried using the histc function but cannot get the plot to display. You have to use the bar function in order to plot the histc data, but the bar function can only have 1 output argument. Could anybody help me out with the correct syntax for the plotyy fucntion now that I'm using the bar() instead of hist()?
bin = 110:10:250;
binneddata = ans / length(data)
[y2,x2] = ecdf(data);
[y1,x1] = bar(binneddata);