www.gusucode.com > stats 源码程序 matlab案例代码 > stats/UseWesternElectric2RuleExample.m
%% Use Western Electric 2 Rule %% Load the sample data % Copyright 2015 The MathWorks, Inc. load parts; %% XBar Chart with WE2 Rule % Construct the Xbar control chart using the Western Electric 2 rule (2 % of 3 points at least 2 standard errors above the center line) to mark the % out of control measurements. st = controlchart(runout,'rules','we2'); %% Plot 2 Standard Errors Line % For a better understanding of the Western Electric 2 rule, calculate and % plot the 2 standard errors line on the chart. x = st.mean; cl = st.mu; se = st.sigma./sqrt(st.n); hold on plot(cl+2*se,'m') %% Identify Out of Control Points % Identify the measurements that violate the control rule. R = controlrules('we2',x,cl,se); I = find(R)