How to get more precise cdf pdf plot?
1 回表示 (過去 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 件)
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!