# cdf

## 语法

``y = cdf(gm,X)``

## 说明

``y = cdf(gm,X)` 返回高斯混合分布 `gm` 的累积分布函数 (cdf)，在 `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]; cdf(gm,X)```
```ans = 4×1 0.5011 0.6250 0.9111 0.9207 ```

```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,p)`
```gm = Gaussian mixture distribution with 2 components in 2 dimensions Component 1: Mixing proportion: 0.400000 Mean: 1 2 Component 2: Mixing proportion: 0.600000 Mean: -3 -5 ```

```gmCDF = @(x,y) arrayfun(@(x0,y0) cdf(gm,[x0 y0]),x,y); fsurf(gmCDF,[-10 10])```