且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

Matlab中的相关性

更新时间:2023-01-02 20:25:25

由于您的数字均为非负数,我认为将相关数组相乘,求和和归一化就足够了.这与corrcoef基本相同,只是一次只能将两个数组相乘.

Since your numbers are all non-negative I think simply multiplying the relevant arrays together, summing, and normalizing would be sufficient. This is basically the same thing that corrcoef does, except it only multiplies two arrays together at a time.

但是请注意,这不适用于负数.例如,假设所有三个数组在某个时刻都为负值.就它们之间的相关性而言,这将是一件好事.不过,只要简单地将它们相乘,便会得到负相关,这表明此时的相关性相反.

Please note, though, that this wouldn't work for negative numbers. For instance, imagine that all three arrays have a negative value at some point. This would be good, in the sense that they are well correlated. Simply multiplying them, though, would give you a negative correlation, which would indicate opposite correlation at that point.