Correlation of two signals. |
||
Syntax |
y = Corr(vec1, vec2, type, length) |
|
Arguments |
Name |
Description |
vec1 |
A vector of real data. |
|
vec2 |
A vector of real data. |
|
type |
Set to "linear" or "circular." Default is "linear". |
|
length (optional) |
The length of the output vector if specified as a positive integer and when type is "circular". If omitted or zero, the length will be the input signal length. If the length is specified as ‘pad’, the length will be rounded up (zero padding the inputs) if necessary to obtain a power of 2. |
|
Output |
Name |
Description |
y |
The output correlation vector. When type is "linear", its length equals the sum of the lengths of the input vectors minus 1. When type is "circular", see the description of length. |
|
Example |
Given two vectors, data1 and data2, a vector of the convolution of the two is created. |
|
Syntax |
||
y = Corr(data1, data2) |
||
Result |
||
y is a vector of the correlation of the two. |
||
Comments |
The linear Corr function computes the cross- correlation between two vectors defined as ∑ g(t)∙h(t-η) for all values of η from 1 to length of the inputs. The result, a normalized, biased correlation between the two vectors, is a vector with a length equal to the sum of the lengths of the two vectors, minus 1. If the same vector is given as vec1 and vec2, the result is the autocorrelation function for that vector. The two vectors are said to be completely correlated at a given lag if the correlation function at that lag is one. They are said to be uncorrelated if the value is zero. |
|
See Also: |