Plotting cumulative frequencies using 'bar' command
7 ビュー (過去 30 日間)
古いコメントを表示
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 件のコメント
回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Annotations についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!