Geoscience Reference
In-Depth Information
sum(pdf(find(x>mu-sigma,1,'first'):find(x<mu+sigma,1,'last')))
which yields
ans =
0.6827
or ~68% at er normalizing the PDF to unity. h e expression
find(x>mu-
sigma,1,'first')
returns the i rst index of
x
where
x
is larger than
mu-sigma
.
Similarly,
find(x<mu+sigma,1,'last')
returns the last index of
x
where
x
is
smaller than
mu+sigma
. Using
sum(pdf(find(x>mu-sigma):find(x<mu+sigma))
instead yields
ans =
0
since the value of
mu-sigma
(11.1788) falls between two values of
x
, 11.178
and 11.179, similar to the value of
mu-sigma
(13.5108) falling between 13.510
and 13.511. Both,
find(x==mu-sigma)
and
find(x==mu+sigma)
return an empty
matrix and hence the sum of the ʼ-˃≤
x
≤ʼ+˃ range is zero. Alternatively, we
can calculate the probability of the -˃≤
x
≤+˃ range from the CDF by typing
cdf(find(x<mu+sigma,1,'last'))-cdf(find(x>mu-sigma,1,'first'))
which yields about the same probability of
ans =
0.6825
or ~68%. Again,
cdf(find(x==mu+sigma))-cdf(find(x==mu-sigma))
yields no result
ans =
Empty matrix: 1-by-0
for the same reason as before. Conversely, we can also calculate the
x
-values
of the ʼ±˃ range of our PDF using the inverse of the cumulative normal
distribution function with
norminv(p,mu,sigma)
by typing
norminv((1-0.6827)/2,mu,sigma)
norminv(1-(1-0.6827)/2,mu,sigma)
which yields