Peak in probability distribution moves in normpdf when changing lower bound for input vector
조회 수: 4 (최근 30일)
이전 댓글 표시
I am trying to compare some data with a computed normal approximation to the dataset. I computed the sample mean and standard deviation the normal ways (mean and std)', I've come up with 40K and 6K (to 1 SF). When I try to plot this distribution using a simple statement:
plot(normpdf(10e3:70e3,40e3,6e3))
It shows the peak in the probability distribution as 30K! When I use a different lower bound for the vector to plot, it moves the probability peak further (e.g., if I start at 20K, the peak moves to 20K).
It appears that the peak in the distribution is appearing at $MEAN- /$LOWER_BOUND, as when I set the lower bound to zero, I get the expected behavior of a normal PDF centered at 40K. The standard deviation of 6K appears to be correctly used in all cases.
Similar behavior is manifested when using a negative lower bound: using the below command changes the peak in the probability displayed to 60K
plot(normpdf(-20e3:70e3,40e3,6e3))
댓글 수: 0
채택된 답변
David Goodmanson
2025년 4월 14일
편집: David Goodmanson
2025년 4월 14일
Hi Chris, try
x = 10e3:70e3;
plot(x,normpdf(x,40e3,6e3))
The problem occurs because if you create y = f(x) and use plot(y), the plot command has no way of knowing what the x array might have been. Without an explicit x input, the x axis is taken to be the y array indices 1:length(y).
추가 답변 (0개)
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!