首页 > 解决方案 > matlab如何测试测量值之间的显着差异?

问题描述

我有一个电子元件的输出样本,我想知道我的系统稳健的 p 值。理想情况下,我想得到一个 p 值(P<0.05)来证明我的系统可以不断产生相同的结果。请注意,我的数据样本很小。

我的输出:

sample=[2.180213,2.178298   ,2.310851   ,2.114255   ,3.012553   ,2.69234    ,2.079787];

我尝试使用:

[h,p] = chi2gof(sample,'CDF',pd)
[h,p,ci,stats] = ttest(x)
[h,p,stats] = fishertest(x)
[h,p,ksstat,cv] = kstest(___)

我搞不清楚了!我在 MATLAB 上执行什么样的测试来真正测试我的输出彼此之间的接近程度以及我的系统输出的一致性(使用 p 值)?

编辑:我试过这个:

sample=[2.180213,2.178298   ,2.310851   ,2.114255   ,3.012553   ,2.69234    ,2.079787];
n = numel(sample);
xobs = mean(sample);  % Sample mean
s = std(sample);     % Sample standard deviation
[h,p] = ttest(sample,xobs)

结果是:

h =

     0


p =

     1

我的数字有点接近,但结果没有意义。h = 0 表示均值为真且未被拒绝,但 p 值为 1!为什么这么高!

标签: matlabp-valueconsistencyhypothesis-test

解决方案


我相信我想通了。我选择了一个任意平均值,这是我想要输出的理想值,并将其用作假设条件。

sample=[2.180213,2.178298   ,2.310851   ,2.114255   ,3.012553   ,2.69234    ,2.079787];
n = numel(sample);
xobs = mean(sample);  % Sample mean
s = std(sample);     % Sample standard deviation
[h,p] = ttest(sample,3)

推荐阅读