www.gusucode.com > stats 源码程序 matlab案例代码 > stats/UseWesternElectricControlRuleExample.m

    %% Use Western Electric Control Rule
%%
% Load the sample data.

% Copyright 2015 The MathWorks, Inc.

load parts;
%%
% Create an Xbar chart using the |we2| rule to mark out of control
% measurements.
st = controlchart(runout,'rules','we2');
x = st.mean;
cl = st.mu;
se = st.sigma./sqrt(st.n);
hold on
plot(cl+2*se,'m')
%%
% You can see the out of control points marked with a red circle.
%%
% Use |controlrules| to identify the measurements that violate the control
% rule.
R = controlrules('we2',x,cl,se);
I = find(R)