PDA

查看完整版本 : 如何在Matlab中显示我的100x1矢量数据的经验pdf?


poster
2019-12-10, 20:48
我有一个100x1向量的数据。如何在Matlab中显示其经验pdf?另外,如果我想在同一张图上比较三个向量的pdf,那么该怎么做?

现在,我正在使用pdfplot.m (http://www.mathworks.com/matlabcentral/fileexchange/8578-pdfplot)文件来绘制我的经验pdf,但是,当我想使用“保持”来比较3个分布时,首先它不起作用,其次所有颜色都使用相同的颜色。谢谢!

编辑:我不想绘制CDF。



回答:

历史 (http://www.mathworks.com/help/techdoc/ref/hist.html) :

hist(data) 或者,如果您想更好地控制其呈现方式,请使用:

[n,x] = hist(data); plot(x,n,'rx-'); %# just an example, plot the pdf with red x's and a line, %# instead of bars figure; plot(x, cumsum(n)/sum(n)); %# plot the CDF

更多&回答... (https://stackoverflow.com/questions/3824724)