# Capability Studies

Before going into production, many manufacturers run a capability study to determine if their process will run within specifications enough of the time. Capability indices produced by such a study are used to estimate expected percentages of defective parts.

Capability studies are conducted with the `capability` function. The following capability indices are produced:

• `mu` — Sample mean

• `sigma` — Sample standard deviation

• `P` — Estimated probability of being within the lower (`L`) and upper (`U`) specification limits

• `Pl` — Estimated probability of being below `L`

• `Pu` — Estimated probability of being above `U`

• `Cp``(U-L)/(6*sigma)`

• `Cpl``(mu-L)./(3.*sigma)`

• `Cpu``(U-mu)./(3.*sigma)`

• `Cpk``min(Cpl,Cpu)`

As an example, simulate a sample from a process with a mean of 3 and a standard deviation of 0.005:

```rng default; % For reproducibility data = normrnd(3,0.005,100,1);```

Compute capability indices if the process has an upper specification limit of 3.01 and a lower specification limit of 2.99:

`S = capability(data,[2.99 3.01])`
```S = struct with fields: mu: 3.0006 sigma: 0.0058 P: 0.9129 Pl: 0.0339 Pu: 0.0532 Cp: 0.5735 Cpl: 0.6088 Cpu: 0.5382 Cpk: 0.5382 ```

Visualize the specification and process widths:

```capaplot(data,[2.99 3.01]); grid on``` 