2015-08-27 29 views
0

我有2個矢量發現不重疊的範圍

Upper_bound = [421.1706;418.7937;425.9144;431.7096]; 
Lower_bound = [376.0487;395.4193;402.7083;419.0457]; 

代表的4個測量值(A,B,C,D)的95%置信區間。 如何以自動方式計算各種度量之間是否存在顯着差異(即95%置信區間不重疊)。

我的優選輸出將是:

sign_diff = [0 0 0 0; 
      0 0 0 1; 
      0 0 0 0; 
      0 1 0 0]; 

指示不從A,B,C,d是不同的。

B不從A,B,C不同,但它從D.

等不同

感謝

+0

聽起來像一個逆問題(ax = b)? – user3528438

回答

3

您可以使用做計算

sign_diff = bsxfun(@ge, Lower_bound, Upper_bound') |... 
      bsxfun(@le, Upper_bound, Lower_bound') 

結果與:

sign_diff = 
0  0  0  0 
0  0  0  1 
0  0  0  0 
0  1  0  0 
+0

謝謝,但輸出與預期不同。 – gabboshow

+0

@gabboshow我意外混合了下限和上限。請參閱我的編輯 – Shai

0

Shai's answer

sign_diff = ~(bsxfun(@le, Lower_bound, Upper_bound') &... 
      bsxfun(@ge, Upper_bound, Lower_bound')) 

我不能評論,所以我將它張貼作爲答案。