How to mathematically describe lag measured from cross correlation
up vote
0
down vote
favorite
In MATLAB, this is the function used to measure lag
using cross-correlation
:
[acor,lag] = xcorr(s2,s1);
[~,I] = max(abs(acor));
lagDiff = lag(I)
timeDiff = lagDiff/Fs
where $s1$ and $s2$ are the signals, $acor$ is the cross-correlation coefficent $r$, $I$ is the coordination of $lag$ at which the maximum cross correlation occurs
Can somebody help me to explain $lagDiff$ in mathematical form?
mathematical-modeling
add a comment |
up vote
0
down vote
favorite
In MATLAB, this is the function used to measure lag
using cross-correlation
:
[acor,lag] = xcorr(s2,s1);
[~,I] = max(abs(acor));
lagDiff = lag(I)
timeDiff = lagDiff/Fs
where $s1$ and $s2$ are the signals, $acor$ is the cross-correlation coefficent $r$, $I$ is the coordination of $lag$ at which the maximum cross correlation occurs
Can somebody help me to explain $lagDiff$ in mathematical form?
mathematical-modeling
it is the lag at which the maximum cross correlation occurs
– Michael Stachowsky
Nov 15 at 15:16
@michaelStachowsky edited based on your suggestion
– Sharah
Nov 15 at 15:19
add a comment |
up vote
0
down vote
favorite
up vote
0
down vote
favorite
In MATLAB, this is the function used to measure lag
using cross-correlation
:
[acor,lag] = xcorr(s2,s1);
[~,I] = max(abs(acor));
lagDiff = lag(I)
timeDiff = lagDiff/Fs
where $s1$ and $s2$ are the signals, $acor$ is the cross-correlation coefficent $r$, $I$ is the coordination of $lag$ at which the maximum cross correlation occurs
Can somebody help me to explain $lagDiff$ in mathematical form?
mathematical-modeling
In MATLAB, this is the function used to measure lag
using cross-correlation
:
[acor,lag] = xcorr(s2,s1);
[~,I] = max(abs(acor));
lagDiff = lag(I)
timeDiff = lagDiff/Fs
where $s1$ and $s2$ are the signals, $acor$ is the cross-correlation coefficent $r$, $I$ is the coordination of $lag$ at which the maximum cross correlation occurs
Can somebody help me to explain $lagDiff$ in mathematical form?
mathematical-modeling
mathematical-modeling
edited Nov 15 at 15:17
asked Nov 15 at 14:35
Sharah
186
186
it is the lag at which the maximum cross correlation occurs
– Michael Stachowsky
Nov 15 at 15:16
@michaelStachowsky edited based on your suggestion
– Sharah
Nov 15 at 15:19
add a comment |
it is the lag at which the maximum cross correlation occurs
– Michael Stachowsky
Nov 15 at 15:16
@michaelStachowsky edited based on your suggestion
– Sharah
Nov 15 at 15:19
it is the lag at which the maximum cross correlation occurs
– Michael Stachowsky
Nov 15 at 15:16
it is the lag at which the maximum cross correlation occurs
– Michael Stachowsky
Nov 15 at 15:16
@michaelStachowsky edited based on your suggestion
– Sharah
Nov 15 at 15:19
@michaelStachowsky edited based on your suggestion
– Sharah
Nov 15 at 15:19
add a comment |
1 Answer
1
active
oldest
votes
up vote
1
down vote
accepted
Let $X = langle x_1, cdots x_nrangle$ be the vector of cross correlations, where the subscript indicates the lag - you may suitable turn this into a time value if you know the time step of your original data. We can define the lag vector much more simply: $L = langle 1, 2, ..., n rangle$, and let $L_i$ be the $i^{th}$ component.
Then $I = underset{i}{operatorname{argmax}}X$
Your "lagDiff" is just $L_{I}$.
EDIT: Explaining some notation in general
The "argmax" operation is related to finding a maximum. Using our above example,
$M = underset{i}{operatorname{max}}X$ means: "search through all of the $x_i$ components of $X$, and find the biggest one". Literally: find the maximum of $X$. $M$ will be the maximum value we've found.
Then $I = underset{i}{operatorname{argmax}}X$ means "search through all of the $x_i$ components of $X$, and find the biggest one. We aren't interested in knowing what that is. Instead, we want to know the index at which it occurs." That index is stored in I.
Thank you for your answer. However, I need further clarification between the relationship between $I$ and $ i$ using theargmax
(I am still learning about math symbols). Is argmax $i$ means the index $i-th$ of where $X$ is max. To put this simply, is $i$ here automatically refers to an index?
– Sharah
Nov 15 at 16:37
I've edited my answer, hopefully it explains a bit more
– Michael Stachowsky
Nov 15 at 18:00
add a comment |
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
1
down vote
accepted
Let $X = langle x_1, cdots x_nrangle$ be the vector of cross correlations, where the subscript indicates the lag - you may suitable turn this into a time value if you know the time step of your original data. We can define the lag vector much more simply: $L = langle 1, 2, ..., n rangle$, and let $L_i$ be the $i^{th}$ component.
Then $I = underset{i}{operatorname{argmax}}X$
Your "lagDiff" is just $L_{I}$.
EDIT: Explaining some notation in general
The "argmax" operation is related to finding a maximum. Using our above example,
$M = underset{i}{operatorname{max}}X$ means: "search through all of the $x_i$ components of $X$, and find the biggest one". Literally: find the maximum of $X$. $M$ will be the maximum value we've found.
Then $I = underset{i}{operatorname{argmax}}X$ means "search through all of the $x_i$ components of $X$, and find the biggest one. We aren't interested in knowing what that is. Instead, we want to know the index at which it occurs." That index is stored in I.
Thank you for your answer. However, I need further clarification between the relationship between $I$ and $ i$ using theargmax
(I am still learning about math symbols). Is argmax $i$ means the index $i-th$ of where $X$ is max. To put this simply, is $i$ here automatically refers to an index?
– Sharah
Nov 15 at 16:37
I've edited my answer, hopefully it explains a bit more
– Michael Stachowsky
Nov 15 at 18:00
add a comment |
up vote
1
down vote
accepted
Let $X = langle x_1, cdots x_nrangle$ be the vector of cross correlations, where the subscript indicates the lag - you may suitable turn this into a time value if you know the time step of your original data. We can define the lag vector much more simply: $L = langle 1, 2, ..., n rangle$, and let $L_i$ be the $i^{th}$ component.
Then $I = underset{i}{operatorname{argmax}}X$
Your "lagDiff" is just $L_{I}$.
EDIT: Explaining some notation in general
The "argmax" operation is related to finding a maximum. Using our above example,
$M = underset{i}{operatorname{max}}X$ means: "search through all of the $x_i$ components of $X$, and find the biggest one". Literally: find the maximum of $X$. $M$ will be the maximum value we've found.
Then $I = underset{i}{operatorname{argmax}}X$ means "search through all of the $x_i$ components of $X$, and find the biggest one. We aren't interested in knowing what that is. Instead, we want to know the index at which it occurs." That index is stored in I.
Thank you for your answer. However, I need further clarification between the relationship between $I$ and $ i$ using theargmax
(I am still learning about math symbols). Is argmax $i$ means the index $i-th$ of where $X$ is max. To put this simply, is $i$ here automatically refers to an index?
– Sharah
Nov 15 at 16:37
I've edited my answer, hopefully it explains a bit more
– Michael Stachowsky
Nov 15 at 18:00
add a comment |
up vote
1
down vote
accepted
up vote
1
down vote
accepted
Let $X = langle x_1, cdots x_nrangle$ be the vector of cross correlations, where the subscript indicates the lag - you may suitable turn this into a time value if you know the time step of your original data. We can define the lag vector much more simply: $L = langle 1, 2, ..., n rangle$, and let $L_i$ be the $i^{th}$ component.
Then $I = underset{i}{operatorname{argmax}}X$
Your "lagDiff" is just $L_{I}$.
EDIT: Explaining some notation in general
The "argmax" operation is related to finding a maximum. Using our above example,
$M = underset{i}{operatorname{max}}X$ means: "search through all of the $x_i$ components of $X$, and find the biggest one". Literally: find the maximum of $X$. $M$ will be the maximum value we've found.
Then $I = underset{i}{operatorname{argmax}}X$ means "search through all of the $x_i$ components of $X$, and find the biggest one. We aren't interested in knowing what that is. Instead, we want to know the index at which it occurs." That index is stored in I.
Let $X = langle x_1, cdots x_nrangle$ be the vector of cross correlations, where the subscript indicates the lag - you may suitable turn this into a time value if you know the time step of your original data. We can define the lag vector much more simply: $L = langle 1, 2, ..., n rangle$, and let $L_i$ be the $i^{th}$ component.
Then $I = underset{i}{operatorname{argmax}}X$
Your "lagDiff" is just $L_{I}$.
EDIT: Explaining some notation in general
The "argmax" operation is related to finding a maximum. Using our above example,
$M = underset{i}{operatorname{max}}X$ means: "search through all of the $x_i$ components of $X$, and find the biggest one". Literally: find the maximum of $X$. $M$ will be the maximum value we've found.
Then $I = underset{i}{operatorname{argmax}}X$ means "search through all of the $x_i$ components of $X$, and find the biggest one. We aren't interested in knowing what that is. Instead, we want to know the index at which it occurs." That index is stored in I.
edited Nov 15 at 17:17
answered Nov 15 at 15:31
Michael Stachowsky
1,183417
1,183417
Thank you for your answer. However, I need further clarification between the relationship between $I$ and $ i$ using theargmax
(I am still learning about math symbols). Is argmax $i$ means the index $i-th$ of where $X$ is max. To put this simply, is $i$ here automatically refers to an index?
– Sharah
Nov 15 at 16:37
I've edited my answer, hopefully it explains a bit more
– Michael Stachowsky
Nov 15 at 18:00
add a comment |
Thank you for your answer. However, I need further clarification between the relationship between $I$ and $ i$ using theargmax
(I am still learning about math symbols). Is argmax $i$ means the index $i-th$ of where $X$ is max. To put this simply, is $i$ here automatically refers to an index?
– Sharah
Nov 15 at 16:37
I've edited my answer, hopefully it explains a bit more
– Michael Stachowsky
Nov 15 at 18:00
Thank you for your answer. However, I need further clarification between the relationship between $I$ and $ i$ using the
argmax
(I am still learning about math symbols). Is argmax $i$ means the index $i-th$ of where $X$ is max. To put this simply, is $i$ here automatically refers to an index?– Sharah
Nov 15 at 16:37
Thank you for your answer. However, I need further clarification between the relationship between $I$ and $ i$ using the
argmax
(I am still learning about math symbols). Is argmax $i$ means the index $i-th$ of where $X$ is max. To put this simply, is $i$ here automatically refers to an index?– Sharah
Nov 15 at 16:37
I've edited my answer, hopefully it explains a bit more
– Michael Stachowsky
Nov 15 at 18:00
I've edited my answer, hopefully it explains a bit more
– Michael Stachowsky
Nov 15 at 18:00
add a comment |
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmath.stackexchange.com%2fquestions%2f2999780%2fhow-to-mathematically-describe-lag-measured-from-cross-correlation%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
it is the lag at which the maximum cross correlation occurs
– Michael Stachowsky
Nov 15 at 15:16
@michaelStachowsky edited based on your suggestion
– Sharah
Nov 15 at 15:19