主要内容

骗子

使用累积总和检测均值的小变化

描述

example

[IUPPER,ILERD.] = cusum(x)returns the first index of the upper and lower cumulative sums ofxthat have drifted beyond five standard deviations above and below a target mean. The minimum detectable mean shift is set to one standard deviation. The target mean and standard deviations are estimated from the first 25 samples ofx.

example

[IUPPER,ILERD.] = cusum(x,climit,mshift,tmean,TDEV.)指定climit,允许上下累积总和从平均漂移的标准偏差的数量。它还指定最小可检测的平均移位,目标平均值和目标标准偏差。

[IUPPER,ILERD.] = cusum(___,'all')返回上下累积总和超过控制限制的所有索引。

example

[IUPPER,ILERD.,Uppersum,ledersum.] = cusum(___)also returns the upper and lower cumulative sums.

cusum(___)没有输出参数绘制归一化的上下累积总和在目标方面上方和下方的一个标准偏差。

例子

全部收缩

Generate and plot a 100-sample random signal with a linear trend. Reset the random number generator for reproducible results.

rng.('default') rnds = rand(1,100); trnd = linspace(0,1,100); fnc = rnds + trnd; plot(fnc)

图包含轴对象。轴对象包含类型线的对象。

Apply骗子使用输入参数的默认值到函数。

CUSUM(FNC)

图包含轴对象。带有标题C的轴对象U S空白C o n t o l空白-c h a r t fallbine blbank = blank 0。7 6 0 9 7 1 blank sigma indexOf t a r g e t baseline blank = blank 0 . 3 4 1 9 2 2 contains 5 objects of type line.

Compute the mean and standard deviation of the first 25 samples. Apply骗子using these numbers as the target mean and the target standard deviation. Highlight the point where the cumulative sum drifts more than five standard deviations beyond the target mean. Set the minimum detectable mean shift to one standard deviation.

MFNC =平均值(FNC(1:25));SFNC = STD(FNC(1:25));CUSUM(FNC,5,1,MFNC,SFNC)

图包含轴对象。带有标题C的轴对象U S空白C o n t o l空白-c h a r t fallbine blbank = blank 0。7 6 0 9 7 1 blank sigma indexOf t a r g e t baseline blank = blank 0 . 3 4 1 9 2 2 contains 5 objects of type line.

Repeat the calculation using a negative linear trend.

nnc = rnds - trnd; cusum(nnc)

图包含轴对象。带有标题C的轴对象U S空白C o n t o l空白-c h a r t fallbine blbank = blank 0。5 1 8 5 4 7空白Sigma索引T A R G E T Baseline Blank = Blank 0。3 2 8 5 2 2包含5型对象的类型。

Generate a signal resembling motion about an axle that becomes unstable due to wear. Add white Gaussian noise of variance 1/9. Reset the random number generator for reproducible results.

rng.defaultsz = 200; dr = airy(2,linspace(-14.9371,1.2,sz)); rd = dr + sin(2*pi*(1:sz)/5) + randn(1,sz)/3;

绘制不断增长的背景漂移和所得到的信号。

情节(DR)持有绘图(RD,'.-') 抓住离开

图包含轴对象。轴对象包含2个类型的物体。

Find the mean and standard deviation if the drift is not present and there is no noise. Plot the ideal noiseless signal and its stable background.

ID = 0.3 * SIN(2 * PI *(1:SZ)/ 20);ST = ID + SIN(2 * PI *(1:SZ)/ 5);mf =均值(st)
mf = -3.8212e-16
sf = std(st)
SF = 0.7401.
情节(ID)持有plot(st,'.-') 抓住离开

图包含轴对象。轴对象包含2个类型的物体。

使用CUSUM控制图来确定不稳定性的开始。假设当信号是超出其理想行为的三个标准偏差时,系统变得不稳定。指定一个标准偏差的最小可检测移位。

Cusum(RD,3,1,MF,SF)

图包含轴对象。The axes object with title C U S U M blank C o n t r o l blank C h a r t blank mu indexOf t a r g e t baseline blank = blank - 0 . 0 0 0 0 0 0 blank sigma indexOf t a r g e t baseline blank = blank 0 . 7 4 0 0 9 4 contains 6 objects of type line.

Make the violation criterion more strict by increasing the minimum detectable shift. Return all instances of unwanted drift.

cusum(rd,3,1.2,mf,sf,'全部')

图包含轴对象。The axes object with title C U S U M blank C o n t r o l blank C h a r t blank mu indexOf t a r g e t baseline blank = blank - 0 . 0 0 0 0 0 0 blank sigma indexOf t a r g e t baseline blank = blank 0 . 7 4 0 0 9 4 contains 6 objects of type line.

Every hole in golf has an associated "par" that indicates the expected number of strokes needed to sink the ball. Skilled players usually complete each hole with a number of strokes very close to par. It is necessary to play several holes and let scores accumulate before a clear winner emerges in a match.

Ben, Jen, and Ken play a full round, which consists of 18 holes. The course has an assortment of par-3, par-4, and par-5 holes. At the end of the game, the players tabulate their scores.

洞= 1:18;PAR = [4 3 5 3 4 5 3 4 4 4 5 3 5 4 4 4 3 4];nms = {'本';'jen';'ken'};本= [4 3 4 2 3 5 2 3 3 4 3 2 3 3 3 3 2 3];JEN = [4 3 4 3 4 4 3 4 4 4 5 3 4 4 5 5 3 3];ken = [4 3 4 3 5 5 4 4 4 4 5 3 5 4 5 4 3 5];t =桌(洞',par',ben',jen',ken',...'VariableNames',['洞';'par'; nms])
T=18×5表孔PAR BEN JEN KEN _____ _________ 1 4 4 4 4 2 3 3 3 3 3 5 4 4 4 4 3 2 3 3 5 4 3 4 5 6 5 5 4 5 7 3 2 3 4 8 4 3 4 4 4 49 4 3 4 4 10 4 4 4 4 11 5 3 5 5 12 3 2 3 3 3 13 5 3 4 5 14 4 3 4 4 15 4 3 5 5 16 4 3 5 4⋮

圆形的获胜者是累计综合和最终漂移的球员。计算三个玩家确定获胜者的总和。通过设置小阈值,使每个班次进行平均可检测。

[〜,b,〜,bensum] = cusum(本杆,1,1e-4,0);[〜,j,〜,Jensum] = cusum(jen-par,1,1e-4,0);[〜,k,〜,kensum] = cusum(ken-par,1,1e-4,0);情节([bensum; Jensum; kensum]')传奇(NMS,'Location','best')

图包含轴对象。轴对象包含3个类型线的对象。这些物品代表Ben,Jen,Ken。

本赢得了这一轮。通过随机加入或减去每个孔中的行程来模拟他们的下一个游戏。

Ben = Ben + Randi(3,1,18)-2;jen = jen + randi(3,1,18)-2;肯= ken + randi(3,1,18)-2;[〜,b,〜,bensum] = cusum(本杆,1,1e-4,0);[〜,j,〜,Jensum] = cusum(jen-par,1,1e-4,0);[〜,k,〜,kensum] = cusum(ken-par,1,1e-4,0);情节([bensum; Jensum; kensum]')传奇(NMS,'Location','best')

图包含轴对象。轴对象包含3个类型线的对象。这些物品代表Ben,Jen,Ken。

输入参数

全部收缩

输入信号, specified as a vector.

例子:重塑(兰特(100,1)* [ - 1 1],1,200)

控制极限, specified as a real scalar expressed in standard deviations.

最小平均转移以检测,指定为标准偏差中的实际标量。

目标意思, specified as a real scalar. Iftmeanis not specified, then it is estimated as the mean of the first 25 samples ofx.

Target standard deviation, specified as a real scalar. IfTDEV.is not specified, then it is estimated as the standard deviation of the first 25 samples ofx.

Output Arguments

全部收缩

Out-of-control point indices, returned as integer scalars or vectors. If all signal samples are within the specified tolerance, then骗子返回空iupper伊尔论点。

上层和下部累积总和,作为向量返回。

More About

全部收缩

CUSUM Control Chart

The CUSUM control chart is designed to detect small incremental changes in the mean of a process.

给定序列x1,x2,x3,......,xn估计平均值mx和估计的标准偏差σ.x, define upper and lower cumulative process sums using:

  • Upper cumulative sum

    U i = { 0 , i = 1 最大限度 ( 0 , U i 1 + x i m x 1 2 n σ. x ) , i > 1

  • Lower sum

    L i = { 0 , i = 1 min ( 0 , L i 1 + x i m x + 1 2 n σ. x ) , i > 1

变量n, represented in骗子by themshiftargument, is the number of standard deviations from the target mean,tmean, that make a shift detectable.

A process violates the CUSUM criterion at the samplexj如果它obeys.Uj>cσ.xorLj< -cσ.x. The control limitcis represented in骗子by theclimit争论。

By default, the function returns the first violation it detects. If you specify the'全部'标志,函数返回每个违规行为。

Extended Capabilities

Version History

Introduced in R2016a

See Also

|