Back
In Matlab I use
a=[1,4,6] b=[1,2,3] corr(a,b)
a=[1,4,6]
b=[1,2,3]
corr(a,b)
which returns .9934. I've tried numpy.correlate but it returns something completely different. What is the simplest way to get the correlation of two vectors?
For getting a correlation of two vectors you can also use numpy.corrcoef:
import numpy print(numpy.corrcoef(a,b))
import numpy
print(numpy.corrcoef(a,b))
31k questions
32.8k answers
501 comments
693 users