C1: sequences of areas
C1: sequences of areas
We can evaluate the Gaussian pdf with the matlab function:
gpdf=@(xnow,munow,signow) (signow*2*pi)^(-length(xnow))*exp((-length(xnow)/2)*((xnow-munow).^2/signow^2));
where xnow is a vector of possible abscissa values and munow and signow are the Gaussian location and scale parameters, respectively:
x=-[1.1 1 .9]; mu=0; sig=1;
Thus, the probability density at x1 and x2 are:
px=gpdf(x,mu,sig);
px([1 3])
Now, the area of the shaded rectangle in Fig. C.4b is:
A1=diff(x([1 3]))*px(1);
which is the base width multiplied by the height of the rectangle. The area of the hatched triangle atop the shaded rectangle in Fig. C.4b is:
A2=(1/2)*diff(x([1 3]))*diff(px([1 3]));
which is one-half the base of the triangle multiplied by its height.
The sum of A1 and A2 should be identical to the area of the shaded region in Fig. C.4c, given by:
A=diff(x([1 3]))*mean(px([1 3]));
which is the base width multiplied by the probability density at the center of the segment.
We can verify that these areas are equal if the logical output:
A==A1+A2
is true.