Controlchart: Syntax

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 6

controlchart

Shewhart control charts

Syntax controlchart(X) controlchart(x,group) controlchart(X,group) [stats,plotdata] = controlchart(x,[group]) controlchart(x,group,'name',value) Description controlchart(X) produces an xbar chart of the measurements in matrix X. Each row of X is considered to be
a subgroup of measurements containing replicate observations taken at the same time. The rows should be in time order. If X is a time series object, the time samples should contain replicate observations. The chart plots the means of the subgroups in time order, a center line ( CL) at the average of the means, and upper and lower control limits (UCL, LCL) at three standard errors from the center line. The standard error is the estimated process standard deviation divided by the square root of the subgroup size. Process standard deviation is estimated from the average of the subgroup standard deviations. Out of control measurements are marked as violations and drawn with a red circle. Data cursor mode is enabled, so clicking any data point displays information about that point. controlchart(x,group) accepts a grouping variable group for a vector of measurements x. groupis a categorical variable, vector, string array, or cell array of strings the same length as

x. Consecutive

measurements x(n) sharing the same value of group(n) for 1 n length(x) are defined to be a subgroup. Subgroups can have different numbers of observations. controlchart(X,group) accepts a grouping variable group for a matrix of measurements in X. In this case, group is only used to label the time axis; it does not change the default grouping by rows.

[stats,plotdata] = controlchart(x,[group]) returns a structure stats of subgroup statistics and parameter estimates, and a structure plotdata of plotted values. plotdata contains one record
for each chart. The fields in stats and plotdata depend on the chart type. The fields in stats are selected from the following:

mean Subgroup means std Subgroup standard deviations range Subgroup ranges n Subgroup size, or total inspection size or area i Individual data values ma Moving averages mr Moving ranges count Count of defects or defective items mu Estimated process mean sigma Estimated process standard deviation p Estimated proportion defective m Estimated mean defects per unit The fields in plotdata are the following: pts Plotted point values

cl Center line lcl Lower control limit ucl Upper control limit se Standard error of plotted point n Subgroup size ooc Logical that is true for points that are out of control controlchart(x,group,'name',value) specifies one or more of the following optional parameter name/value pairs, with name in single quotes: charttype The name of a chart type chosen from among the following: o 'xbar' Xbar or mean o 's' Standard deviation o 'r' Range o 'ewma' Exponentially weighted moving average o 'i' Individual observation o 'mr' Moving range of individual observations o 'ma' Moving average of individual observations o 'p' Proportion defective o 'np' Number of defectives o 'u' Defects per unit o 'c' Count of defects
Alternatively, a parameter can be a cell array listing multiple compatible chart types. There are four sets of compatible types:

'xbar', 's', 'r', and 'ewma' 'i', 'mr', and 'ma' 'p' and 'np' 'u' and 'c' display Either 'on' (default) to display the control chart, or 'off' to omit the display label A string array or cell array of strings, one per subgroup. This label is displayed as part of the
o o o o
data cursor for a point on the plot. lambda A parameter between 0 and 1 controlling how much the current prediction is influenced by past observations in an EWMA plot. Higher values of

'lambda' give less weight to past observations and

more weight to the current observation. The default is 0.4. limits' A three-element vector specifying the values of the lower control limit, center line, and upper control limits. Default is to estimate the center line and to compute control limits based on the estimated value of sigma. Not permitted if there are multiple chart types. mean Value for the process mean, or an empty value (default) to estimate the mean from the p parameter for p and np charts, the mean defects per unit for u and c charts, and the normal muparameter for other charts.

X. This is

nsigma The number of sigma multiples from the center line to a control limit. Default is 3. parent The handle of the axes to receive the control chart plot. Default is to create axes in a new
figure. Not permitted if there are multiple chart types. rules The name of a control rule, or a cell array containing multiple control rule names. These rules, together with the control limits, determine if a point is marked as out of control. The default is to apply no control rules, and to use only the control limits to decide if a point is out of control. Seecontrolrules for more information. Control rules are applied to charts that measure the process

level (xbar, i, c, u, p, and np) rather than the variability (r, s), and they are not applied to charts based on moving statistics (ma, mr, ewma).

sigma Either a value for sigma, or a method of estimating sigma chosen from among 'std' (the default) to use the average within-subgroup standard deviation, 'range' to use the average subgroup range, and 'variance' to use the square root of the pooled variance. When creating i,mr, or ma charts for data not in subgroups, the estimate is always based on a moving range. specs A vector specifying specification limits. Typically this is a two-element vector of lower and upper
specification limits. Since specification limits typically apply to individual measurements, this parameter is primarily suitable for i charts. These limits are not plotted on r, s, or mr charts.

unit The total number of inspected items for p and np charts, and the size of the inspected unit for u and c charts. In both cases X must be the count of the number of defects or defectives found. Default is 1 for u and c charts. This argument is required (no default) for p and np charts. width The width of the window used for computing the moving ranges and averages in mr and macharts, and for computing the sigma estimate in i, mr, and ma charts. Default is 5. Examples
Create xbar and r control charts for the data in parts.mat:

load parts st = controlchart(runout,'chart',{'xbar' 'r'});

Display the process mean and standard deviation:

fprintf('Parameter estimates: %g\n',st.mu,st.sigma); Parameter estimates: More About

mu = %g, sigma =

mu = -0.0863889, sigma = 0.130215

Control Charts
A control chart displays measurements of process samples over time. The measurements are plotted together with user-defined specification limits and process-defined control limits. The process can then be compared with its specificationsto see if it is in control or out of control. The chart is just a monitoring tool. Control activity might occur if the chart indicates an undesirable, systematic change in the process. The control chart is used to discover the variation, so that the process can be adjusted to reduce it. Control charts are created with the

controlchart function. Any of the following chart types may be specified:

Xbar or mean Standard deviation Range Exponentially weighted moving average Individual observation Moving range of individual observations Moving average of individual observations Proportion defective Number of defectives Defects per unit Count of defects Control rules are specified with the

controlrules function.

For example, the following commands create an xbar chart, using the "Western Electric 2" rule (2 of 3 points at least 2 standard errors above the center line) to mark out of control measurements:

load parts; st = controlchart(runout,'rules','we2'); x = st.mean; cl = st.mu; se = st.sigma./sqrt(st.n);

hold on plot(cl+2*se,'m')

Measurements that violate the control rule can then be identified:

R = controlrules('we2',x,cl,se); I = find(R) I = 21 23 24 25

26 27

You might also like