Thread Subject:
Histogram to Probability ditribution function

Subject: Histogram to Probability ditribution function

From: Mehdi bahonar

Date: 13 Mar, 2010 08:47:05

Message: 1 of 4

Hi There,

Do you know how we can convert histogram plot to probability density function plot?

Thanks,
maryam

Subject: Histogram to Probability ditribution function

From: Sadik

Date: 13 Mar, 2010 11:03:06

Message: 2 of 4

a = randn(1,10000);
[n,x] = hist(a,50);
plot(x,n/10000/diff(x(1:2)))
hold on
plot(x,normpdf(x,0,1),'r')

Therefore, n/10000/diff(x(1:2)) is your pdf. [diff(x(1:2)) looks at deltaX, that is bin width.]

"Mehdi bahonar" <mehdiuoc@yahoo.com> wrote in message <hnfje9$r0d$1@fred.mathworks.com>...
> Hi There,
>
> Do you know how we can convert histogram plot to probability density function plot?
>
> Thanks,
> maryam

Subject: Histogram to Probability ditribution function

From: Wayne King

Date: 13 Mar, 2010 15:44:05

Message: 3 of 4

"Mehdi bahonar" <mehdiuoc@yahoo.com> wrote in message <hnfje9$r0d$1@fred.mathworks.com>...
> Hi There,
>
> Do you know how we can convert histogram plot to probability density function plot?
>
> Thanks,
> maryam

Hi maryam, if you have the Statistics Toolbox, histfit() will superimpose a probability density function for a number of distributions.
Wayne

Subject: Histogram to Probability ditribution function

From: the cyclist

Date: 13 Mar, 2010 20:43:05

Message: 4 of 4

"Mehdi bahonar" <mehdiuoc@yahoo.com> wrote in message <hnfje9$r0d$1@fred.mathworks.com>...
> Hi There,
>
> Do you know how we can convert histogram plot to probability density function plot?
>
> Thanks,
> maryam

As has been mentioned, use HISTFIT if you know the underlying distribution type that you want to fit (e.g. normal distribution). If you do not, then you need to do a non-parametric fit. You can use the KSDENSITY function to do this. Note that this is a bit of an art in addition to science. You might want to read up on "kernel density estimation".

Tags for this Thread

Everyone's Tags:

Add a New Tag:

Separated by commas
Ex.: root locus, bode

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Tag Activity for This Thread
Tag Applied By Date/Time
histogram to proba... Mehdi bahonar 13 Mar, 2010 03:49:06
rssFeed for this Thread

Contact us