Plotting cumulative frequencies using 'bar' command

Hello
I have 2 sets (A and B) of values where length(A) equals length(B)
The distribution of numbers in A and B, range from min(A) to max(A).(min(A) equals min(B) and max(A) equals max(B))
I calculate cumulative frequencies for A and B as below:
[CountsA,BincentersA]=cumsum(hist(A)); [CountsB,BincentersB]=cumsum(hist(B));
Now, I plot a bar chart comparing cumulative frequency distributions of A and B (on X axis, I have BincentersA)
figure;
width1=0.5;
bar(BincentersA,cumsum(hist(A)),width1,'r');
hold on;
width2=width1/2;
bar(BincentersA,cumsum(hist(B)),width2,'b');
I have 2 questions: 1. Is the logic "'cumsum(hist)' comparing with bincenters I got from hist" correct for plotting cumulative frequencies Vs bin centers?
2. I am getting a bar plot with bars spaced little distant from each other. How do I get bars with no space between them (continuous bars along x axis)?
Thanks for the help Harish

Réponses (0)

Catégories

En savoir plus sur Data Distribution Plots dans Centre d'aide et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by