Main Content

capaplot

Process capability plot

Description

p = capaplot(X,specs) returns the probability that a new observation from a normal distribution fitted to X falls within the specification range given by specs. The function displays a plot of the fitted distribution function and the specification range.

example

p = capaplot(ax,X,specs) plots into the axes specified by ax instead of the current axes (gca). (since R2024a)

[p,h] = capaplot(___) additionally returns handles to the plot elements in h, using any of the input argument combinations in the previous syntaxes.

Examples

collapse all

Simulate a sample of 100 measurements from a process with a mean of 3 and a standard deviation of 0.005.

X = normrnd(3,0.005,100,1);

Set a lower specification limit of 2.99 and an upper specification limit of 3.01 for the process, and then compute the capability indices.

specs = [2.99 3.01];
S = capability(X,specs)
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(X,specs);

Figure contains an axes object. The axes object with title Probability Between Limits = 0.91292 contains 5 objects of type patch, line. This object represents Normal Distribution.

Input Arguments

collapse all

Input data, specified as a numeric vector.

Data Types: single | double

Specification limits, specified as a two-element numeric vector that contains the lower and upper specification limits. If there is no lower specification bound, specify the first element of specs as –Inf. If there is no upper specification bound, specify the second element of specs as Inf.

Example: [0 4]

Data Types: single | double

Target axes for the plot, specified as an Axes object. If you do not specify ax, then capaplot creates the plot using the current axes. For more information on creating an Axes object, see axes.

Output Arguments

collapse all

Probability value, returned as a numeric scalar. p is the probability that a new observation from a normal distribution fitted to X falls within the specification range in specs.

capaplot treats NaN values in X as missing and ignores them.

Handles to the plot elements, returned as a handle array.

References

[1] Montgomery, Douglas C. Statistical Quality Control. 7th ed. Nashville, TN: John Wiley & Sons, 2012.

Version History

Introduced before R2006a

expand all