# pdf

## 说明

y = pdf(gm,X) 返回高斯混合分布 gm 的概率密度函数 (pdf)，在 X 中的值处计算函数值。

## 示例

mu = [1 2;-3 -5];
sigma = [1 1]; % shared diagonal covariance matrix

gm = gmdistribution(mu,sigma)
gm =

Gaussian mixture distribution with 2 components in 2 dimensions
Component 1:
Mixing proportion: 0.500000
Mean:     1     2

Component 2:
Mixing proportion: 0.500000
Mean:    -3    -5

X = [0 0;1 2;3 3;5 3];
pdf(gm,X)
ans = 4×1

0.0065
0.0796
0.0065
0.0000

p = [0.4 0.6];               % Mixing proportions
mu = [1 2;-3 -5];            % Means
sigma = cat(3,[2 .5],[1 1])  % Covariances 1-by-2-by-2 array
sigma =
sigma(:,:,1) =

2.0000    0.5000

sigma(:,:,2) =

1     1

cat 函数沿第三个数组维度串联协方差。定义的协方差矩阵是对角矩阵。sigma(1,:,i) 包含成分 i 的协方差矩阵的对角线元素。

gm = gmdistribution(mu,sigma)
gm =

Gaussian mixture distribution with 2 components in 2 dimensions
Component 1:
Mixing proportion: 0.500000
Mean:     1     2

Component 2:
Mixing proportion: 0.500000
Mean:    -3    -5

gmPDF = @(x,y) arrayfun(@(x0,y0) pdf(gm,[x0 y0]),x,y);
fsurf(gmPDF,[-10 10])

## 输出参量

$y\left(i\right)=\sum _{j=1}^{k}L\left({C}_{j}|{O}_{i}\right)\text{P}\left({\text{C}}_{j}\right),$