两种不同的相关系数表达式怎么结果不一样,怎么回事?
>> a = [1 2 3 4 5]
a =
1 2 3 4 5
>> b = [-2 -1 0 -2 2]
b =
-2 -1 0 -2 2
>> r = xcorr(a, b)
r =
2.0000 2.0000 2.0000 1.0000 -2.0000 -17.0000 -10.0000 -13.0000 -10.0000
>> r1 = xcorr(a)
r1 =
5.0000 14.0000 26.0000 40.0000 55.0000 40.0000 26.0000 14.0000 5.0000
>> r2 = xcorr(b)
r2 =
-4.0000 2.0000 2.0000 -2.0000 13.0000 -2.0000 2.0000 2.0000 -4.0000
>> c = corrcoef(a, b)
c =
1.0000 0.6614
0.6614 1.0000
>> c1 = cov(a, b)
c1 =
2.5000 1.7500
1.7500 2.8000
>> c11 = var(a)
c11 =
2.5000
>> c12 = var(b)
c12 =
2.8000
a = [1, 2, 3, 4, 5] b = [-2 -1 0 -2 2]
mean(a) = 3 mean(b) = -0.6
xcorr(a, b)
c = --------------- 能量Ea = 55, 能量Eb = 13
(Ea x Eb).^0.5
cov(a, b)
c = ------------------------- var(a) = 2.5, var(b) = 2.8
( var(a) x var(b) ).^0.5
[解决办法]
2.5 x 2.8 = 7 7^0.5 = 2.6458 1.75/2.6458 = 0.6614是对的
55 x 13 = 715 715^0.5 = 26.7395 ?/26.7395 = 0.6614
? = 17.6855 那?是什么啊