Article directory
foreword
Two-dimensional normal distribution, also known as two-dimensional Gaussian distribution (English: Two-dimensional Gaussian distribution, named after the German mathematician Carl Friedrich Gauss), is a distribution in the fields of mathematics, physics and engineering. A very important probability distribution, because this distribution function has many very beautiful properties, it has a great influence in many fields involving statistical science, discrete science and other fields. For example, the most commonly used filter type in image processing is the Gaussian filter (also known as the normal distribution function).
https://baike.baidu.com/item/%E4%BA%8C%E7%BB%B4%E6%AD%A3%E6%80%81%E5%88%86%E5%B8%83/2951835
1. Interpretation of the formula
You can refer to the excellent answers of the following authors. This article is mainly about how to use Matlab to construct a two-dimensional joint probability density function.
https://blog.csdn.net/tanghonghanhaoli/article/details/82753174#:~:text=%E4%BA%8C%E7%BB%B4%E6%AD%A3%E6%80%81%E9%9A%8F%E6%9C%BA%E5%8F%98%E9%87%8F%20%E6%A6%82%E7%8E%87%E5%AF%86%E5%BA%A6%E5%87%BD%E6%95%B0%20%E4%B8%89%E7%BB%B4%E5%9B%BE%E7%9A%84matlab%E5%AE%9E%E7%8E%B0%201.%E4%BA%8C%E7%BB%B4%E6%AD%A3%E6%80%81%E9%9A%8F%E6%9C%BA%E5%8F%98%E9%87%8F%20%E4%BA%8C%E7%BB%B4%E6%AD%A3%E6%80%81%E9%9A%8F%E6%9C%BA%E5%8F%98%E9%87%8F%E6%98%AF%E6%9C%80%E5%B8%B8%E8%A7%81%E7%9A%84%E4%B8%80%E7%A7%8D%E4%BA%8C%E7%BB%B4%E9%9A%8F%E6%9C%BA%E5%8F%98%E9%87%8F%E5%88%86%E5%B8%83%E3%80%82.%20%E5%85%B6%E8%81%94%E5%90%88%20%E6%A6%82%E7%8E%87%E5%AF%86%E5%BA%A6%E5%87%BD%E6%95%B0%20%E4%B8%BA%EF%BC%9A,%281-r%5E2%29%7D%20%5Bfrac%20%7B%20%28x-m_X%5E2%29%7D%20%7Bsigm.%20%E5%A4%9A%E7%BB%B4%E9%AB%98%E6%96%AF%E9%9A%8F%E6%9C%BA%E5%8F%98%E9%87%8F %20%E6%A6%82%E7%8E%87%E5%AF%86%E5%BA%A6%E5%87%BD%E6%95%B0%20%28PDF%29%E7%9A%84 %E6%8E%A8%E5%AF%BC.
2. Construction process
1. First find the mean (expected value), variance (or standard deviation), and correlation coefficient
x=-10:0.5:10;
y=-10:0.5:10;
u1 = 0.000178; %均值
u2 = -0.000208;
sigma1 = 1.507 ; %方差
sigma2 = 1.05729;
rou = 0.04; %相关系数
In another article some how to find the mean, variance and correlation coefficient
2. Write out the joint PDF
mu=[-1,2];
[X,Y]=meshgrid(x,y); % 产生网格数据并处理
p = 1/(2*pi*sigma1*sigma2*sqrt(1-rou*rou)).*exp(-1/(2*(1-rou^2)).*[(X-u1).*(X-u1)/(sigma1*sigma1)-2*rou*(X-u1).*(Y-u2)/(sigma1*sigma2)+(Y-u2).*(Y-u2)/(sigma2*sigma2)]);
3. Drawing
figure(2)
surf(X,Y,p)
shading interp
colorbar
ax=gca;
ax.Projection='perspective';
ax.LineWidth=.8;
ax.XMinorTick='on';
ax.YMinorTick='on';
ax.ZMinorTick='on';
ax.GridLineStyle=':';
Summarize
Through the above method, you can draw the 2D combined PDF
. Note:
- To prepare the mean and variance
- To calculate the correlation coefficient