MATLAB中三个变量之间的关联 [英] Correlation between three variables in MATLAB
本文介绍了MATLAB中三个变量之间的关联的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在MATLAB中,我具有以下内容:
In MATLAB, I have the following:
A,B,C是1 x 101行向量。我知道,对于从1到101的 i,A(i),B(i)和C(i)是线性相关的。
A, B, C are 1 x 101 row vectors. I know that for 'i' from 1 to 101, A(i), B(i), and C(i) are linearly correlated.
如何识别A,B和C之间的依赖关系?
How can I identify the dependence between A, B, and C?
推荐答案
对于相关程度,可以使用 corrcoef
:
For the degree of correlation, you can use corrcoef
:
data = [A(:) B(:) C(:)];
correlation = corrcoef(data);
这里有一个测试案例,显示了正/负相关性以及相关程度,并带有
Here's a test case that shows positive/negative correlation as well as the degree of correlation, with
N = 10000;
A = randn(N,1);
B = 3*A + randn(N,1);
C = -2*A + 20*randn(N,1);
correlation =
1.0000 0.9473 -0.1005
0.9473 1.0000 -0.0927
-0.1005 -0.0927 1.0000
这篇关于MATLAB中三个变量之间的关联的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文