1) use MATLAB to draw a probability density function image with a normal distribution.
X = [-.];
Y = normpdf (x, 0, 1); % normal distribution function.
Figure;
Axes1 = axes ('pos', [0.1 0.1 0.85 0.85]);
Plot (x, y );
Set (axes1, 'ylim', [-0.01 0.43], 'xlim', [-3 3]);
Figure 1:
2) Verify that the point of the probability density function in the interval (-∞, ∞) is 1.
Here, the mu = 3 and Sigma = 5 parameters are used (Note: all these two parameters are used below ).
Y = 'exp (-1/2 * (X-3)/5) ^ 2)/(SQRT (2 * PI) * 5 )';
S = int (Y,-INF, INF) % int integral function (INF stands for infinity ).
Output: S = 1
3) the maximum value is obtained when x = Mu is verified.
Idea: Solve the point where the first derivative of the function is zero.
* First Derivative
Y = 'exp (-1/2 * (X-3)/5) ^ 2)/(SQRT (2 * PI) * 5 )';
D = diff (y); % differential function.
SD = simplify (d)
Output result: SD =-1/250 * (X-3) * exp (-1/50 * (X-3) ^ 2) * 2 ^ (1/2)/PI ^ (1/2)
* Determine the resolution position through the image
X = [0: 0.];
SD =-1/250.*(X-3 ). * exp (-1/50.*(X-3 ). ^ 2 ). * 2. ^ (1/2 ). /PI. ^ (1/2 );
Axes1 = axes ('pos', [0.1 0.1 0.85 0.85]);
Plot (x, SD );
Set (axes1, 'ylim', [-0.01 0.01], 'xlim', [0 40]);
Figure 2:
We can see that there is a solution near 3.
* Define and solve Functions
Function Y = f (x)
Y =-1/250.*(X-3 ). * exp (-1/50.*(X-3 ). ^ 2 ). * 2. ^ (1/2 ). /PI. ^ (1/2 );
R = fzero ('F', 3)
Output: r = 3
From the figure above, we can see that x> 20 is almost a straight line. If 20 is used:
R = fzero ('F', 20)
Output: r = 3
This means that it is infinitely close to 0.
* The value of this parameter is the maximum value.
The first derivative of the probability density function is 0 and the result is 3, which is exactly Mu, and then the function of x = 1, x = 4 and x = 3.Value comparison.
> Normpdf (1, 3, 5)
Ans = 0.0737
> Normpdf (4, 3, 5)
Ans = 0.0782
> Normpdf (3,3, 5)
Ans = 0.0798
Obviously, the function values on both sides of X = 3 are smaller than those on X = 3, indicating that this point is the maximum point. Graph Based on the Normal Distribution FunctionWe can see that this point is the maximum value.
4) Verify that X = Mu +-sigma (8 or-2) has an inflection point.
Idea: Calculate the point where the second derivative is zero.
* First obtain Second-Order Differentiation
Y = 'exp (-1/2 * (X-3)/5) ^ 2)/(SQRT (2 * PI) * 5 )';
D = diff (Y, 2); % differential function.
SD = simplify (d)
Output: SD = 1/6250 * exp (-1/50 * (X-3) ^ 2) * 2 ^ (1/2) * (-16 + x ^ 2-6 * X) /PI ^ (1/2)
* Determine the resolution position through the image
X = [-20:0. 00];
SD = 1. /6250. * exp (-1/50.*(X-3 ). ^ 2 ). * 2. ^ (1/2 ). * (-16 + X. ^ 2-6. * X)/PI. ^ (1/2 );
Axes1 = axes ('pos', [0.1 0.1 0.85 0.85]);
Plot (x, SD );
Set (axes1, 'ylim', [-0.005 0.005], 'xlim', [-20]);
Figure 3:
It can be seen that the curves between (-) and () have an intersection with Y = 0, so there are two solutions.
* Define and solve Functions
Function Y = f (x)
Y = 1. /6250. * exp (-1/50.*(X-3 ). ^ 2 ). * 2. ^ (1/2 ). * (-16 + X. ^ 2-6. * X)/PI. ^ (1/2 );
R = fzero ('F',-5)
R =-2
> R = fzero ('F', 5)
R = 8.0000.
Two inflection points x = 8 and x =-2 are obtained, namely, Mu +-sigma.
5) solve the verification curve with the X axis as the gradient line:
A vertical gradient Line X = A is the gradient line of Y = f (x) <=> Lim f (x) = ∞ or Lim f (x) = ∞
X-> A + 0 x-> a-0
Among them, a is found in the intermittent point -- ∞ type second type of intermittent point B horizontal gradient nearline
X → + ∞ (-∞), Y = B is the gradient line of Y = f (x) <=> Lim f (x) = B (or Lim f (x) = B)
X-> + ∞ X->-∞
Calculate the limit value B when the first order is reciprocal to X tends to infinity. If yes, there is a horizontal gradient line y = B.
* Define the function first:
Function Y = f (x)
Syms X; % defines symbol variables.
Y = exp (-1/2 * (X-3)/5) ^ 2)/(SQRT (2 * PI) * 5 );
* Returns the limit of the first derivative when x tends to infinity.
Limit (F, INF)
Ans = 0
6) Verify the three Sigma rule
Train of Thought: Solve the points of the probability density function in the [mu-3 * Sigma, Mu + 3 * Sigma] interval.
Y = 'exp (-1/2 * (X-3)/5) ^ 2)/(SQRT (2 * PI) * 5 )';
Double (INT (Y,-12, 18 ))
Ans = 0.9973