Functions > Statistics > Descriptive Statistics > Covariance and Correlation
  
Covariance and Correlation
cvar(A, B)—Returns the covariance of the elements of A and B. The covariance is defined as follows:
Click to copy this expression
The overbar denotes the complex conjugate.
The cvar function divides by the total number of values, m∙n, rather than m∙n – 1. To find the covariance corresponding to a denominator of m∙n – 1, multiply the result of this function by m∙n / (m∙n – 1). Dividing by the "sample size minus one," rather than the sample size, provides a better estimate for the true population variance.
corr(A, B)—Returns the Pearson's r correlation coefficient of the elements in A and B. The correlation coefficient is defined as follows:
Click to copy this expression
Arguments
A and B are real or complex arrays of the same size.