## How to derive probabilities from density function?

### Clarisha Nijman (view profile)

on 9 Nov 2018
Latest activity Answered by Star Strider

on 9 Nov 2018

### Star Strider (view profile)

Hello,
I want to use the density function to find probabilities of unit intervals. In the distribution fitting app of Matlab, I draw two distributions I would like to compare. The Nakagami(blue) and the normal distribution (red).
Matlab documentation says that there is a pdf argument that should be added. I tried some combinations, now I have a code that does not give me any error, but the code is not good. It gives me the probabilities based on the counts. So the last line of my code does not work as it should. It should give me probabilities for the unit intervals: [<-5,-4>, [-4,-3>,...., [98,99>, [99,100>, [100,inf>. And that would differ for both distributions. How should I include a specific distribution in the arguments? Or should it be derived from the app? Does anyone have a suggestion for me?
The code is:
Given:
U=[0:9];
lamda=0.42;
Y = poisspdf(U,lamda);%computes the Poisson pdf at each of the values in U using mean parameters in lambda.
W=[-5:100];
a=rand(10,1)+U'.^2;%A range of 10 values that I would like to analyse
pdfCounts=hist(a,W);%derive the pdf based on the histogram
pdfDensity=hist(a,W,'Normalization','pdf');%derive the pdf based on the densityplot