Question

I have the following code, which I use to obtain the graph below. How can I determine the probability density of the values as I want my Y-Axis label to be Probability density or,do I have to normalise the Y-values?

Thanks

% thresh_strain contains a Normally Distributed set of numbers
[mu_j,sigma_j] = normfit(thresh_strain);   
x=linspace(mu_j-4*sigma_j,mu_j+4*sigma_j,200);   
pdf_x = 1/sqrt(2*pi)/sigma_j*exp(-(x-mu_j).^2/(2*sigma_j^2));   
plot(x,pdf_x);

enter image description here

Was it helpful?

Solution

Your figure as it stands is correct - the area under the curve is 1. It does not need to be normalised. You can check this by plotting the cumulative distribution function:

plot(x,(x(2)-x(1)).*cumsum(pdf_x));

The y-axis in your figure needs to be relabeled as it is not "number of dents". "Probability density" is an acceptable label.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top