How to get more precise cdf pdf plot?
조회 수: 4 (최근 30일)
이전 댓글 표시
Chen Zhu
2017년 11월 5일
답변: Kaushik Lakshminarasimhan
2017년 11월 5일
sample1=[...];
sample2=[...];
[p,x] = hist(sample1);
[p2,x2] = hist(sample2);
plot(x,p/sum(p),'r'); %PDF
hold on
plot(x2,p2/sum(p2),'g'); %PDF
I used code above to plot CDF and PDF. However, the plot is not very precise. I want to get more smooth plot. How can I make the distance between each point be 10? Currently, it seems like 100.

Thanks
댓글 수: 0
채택된 답변
Kaushik Lakshminarasimhan
2017년 11월 5일
By default hist uses 10 bins to create a histogram. You can change the resolution either by specifying the number of bins or the bin centres. For example, to make a histogram with 100 bins:
[p,x] = hist(sample1,100);
Alternatively, you can specify the bin centres instead of number of bins.
bincntr = 10:10:2000
[p,x] = hist(sample1,bincntr);
In the second case, x will be equal to bincntr
댓글 수: 0
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Histograms에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!