Plotting cumulative frequencies using 'bar' command

7 ビュー (過去 30 日間)
SreeHarish Muppirisetty
SreeHarish Muppirisetty 2014 年 8 月 15 日
編集済み: SreeHarish Muppirisetty 2014 年 8 月 15 日
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

回答 (0 件)

カテゴリ

Help Center および File ExchangeAnnotations についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by