How can I display empirical pdf of my 100x1 vector data in Matlab?

user238469 picture user238469 · Sep 29, 2010 · Viewed 18.2k times · Source

I have a data which is 100x1 vector. How can I display its empirical pdf in Matlab? Also, if I want to compare the pdf of three vectors on the same graph, then how to do that?

Right now I am using pdfplot.m file to plot my empirical pdf, however when I want to compare the 3 distributions by using 'hold on', then firstly its not working and secondly all the distributions are in same color. Thanks!

EDIT: I don't want to plot cdf.

Answer

Amro picture Amro · Sep 29, 2010

What you are looking for is Kernel density estimation (also known as Parzen windows). Its implemented in KSDENSITY function in the Statistics toolbox:

data = randn(100,1);
ksdensity(data)

alt text

The Wikipedia entry above has a MATLAB example using a function submission on FEX