File Exchange

PDFPLOT

version 1.0 (1.35 KB) by

PDFPLOT displays a histogram of the empirical probability density function (PDF) of the input data.

Updated

PDFPLOT displays a histogram of the empirical probability density function (PDF) for the data in the input array X using nbins number of bins.
If input X is a matrix, then pdfplot(X) parses it to the vector and displays PDF of all values.
For complex input X, pdfplot(X) displays PDF of abs(X).

Example:
y = randn( 1, 1e5 );
pdfplot( y );
pdfplot( y, 100 );

Chung-Han Hsieh

chao

mathworks2011

mathworks2011 (view profile)

[f,xi] = ksdensity(X, 'npoints', 1000);

Amit L

Holger Hiebel

Holger Hiebel (view profile)

Be careful, to get the real PDF estimate replace
bar(X, N/sum(N));
with
bar(X, N/sum(N)/step);

Paul Beekhuizen

Nothing more than just a standard histogram with cleverly chosen bins. Much better techniques exist to display a pdf. On top of that, it is buggy (although this can be easily fixed by the fix proposed in one of the other reviews).

Jon Hyde

Sean Winfree

Yes, the fix suggested by Tim Hattrell
returns the correct pdf. Thanks Tim

seema sudevan

Tim Hattrell

I don't think this calculates the correct PDF as the area under the graph is not one. Replace bar(X, N/sum(N)); with bar(X, N/sum(N)/step); to fix this.

Eoin Elliffe

It would be nice if you could do Ntigram as for pdf you generally need variable bin sizes.

Hong La

Okey, i seem it to be my need but not. This is not new thing, a little simple.

Jonathan Duplicy

good job - what I need.
unbelievable it's not included in stat. toolbox

Li jia

just what i want, thank you

anonym anonym

check how it works:
plot(-3:0.1:3,pdf('norm',-3:0.1:3,0,1))
hold
pdfplot(x,30)

Norbert Pierre

Allows visualization of the data. An extremely useful utility.

sui lasiko

excellent!

x x

whats the numel function?? its not specified

MATLAB Release
MATLAB 6.5.1 (R13SP1)