PDF from a histogram ?

2 次查看(过去 30 天)
MIRK
MIRK 2015-3-20
编辑: MIRK 2015-3-20
Why the plot of PDF of second plot is not the same of the first one what correction should I make on second to make it right PDF

回答(1 个)

Image Analyst
Image Analyst 2015-3-20
What's wrong with
pdf = f / numel(f);
??
  3 个评论
Image Analyst
Image Analyst 2015-3-20
The histogram is the frequency of occurrence of values - in other words, the likelihood that that value will occur. Well, isn't that also the definition of probability density function, except that the pdf has the integral of the function (sum, area under the curve) of 1. So I divided the histogram counts by the number of elements so that when it's integrated (summed), the sum will equal 1, just like the pdf.
Anyway, assuming you get the pdf or histogram, then what? What do you want to do once you have that? We may not need to quibble over histogram details or plots to do whatever it is that you need to really do. So please explain what you plan on doing with the histogram or pdf.
Image Analyst
Image Analyst 2015-3-20
When you plot d, d is
d= f/c/diff(x(1:2))
Well diff(x(1:2)) is just 1 since imhist will default to taking a bin width of 1 gray level. So d is just the counts divided by the number of columns. It should be divided by the number of pixels, which is c*r.

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Histograms 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by