Plotting cumulative frequencies using 'bar' command
조회 수: 2 (최근 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에서 Bar Plots에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!