Here is an example using the PDF normalization (the sum of all the bins is 1). Since 2014b, Matlab has these normalization routines embedded natively in the histogram function (see the help file for the 6 routines this function offers). You can see for yourself which method agrees with the correct answer (red curve).Īnother method (more straightforward than method 2) to normalize the histogram is to divide by sum(f * dx) which expresses the integral of the probability density function, i.e. ![]() = hist(randn(10000, 1), 50) % Create histogram from a normal distribution. ![]() To illustrate my point, try the following example. To get the right density, you must divide by the area. ![]() Dividing by the sum will not give you the correct density. For a probability density function, the integral over the entire space is 1. My answer to this is the same as in an answer to your earlier question.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |