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?










share|cite|improve this question
























  • 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















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?










share|cite|improve this question
























  • 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













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?










share|cite|improve this question















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






share|cite|improve this question















share|cite|improve this question













share|cite|improve this question




share|cite|improve this question








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


















  • 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










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.






share|cite|improve this answer























  • 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











Your Answer





StackExchange.ifUsing("editor", function () {
return StackExchange.using("mathjaxEditing", function () {
StackExchange.MarkdownEditor.creationCallbacks.add(function (editor, postfix) {
StackExchange.mathjaxEditing.prepareWmdForMathJax(editor, postfix, [["$", "$"], ["\\(","\\)"]]);
});
});
}, "mathjax-editing");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "69"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
noCode: true, onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














 

draft saved


draft discarded


















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

























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.






share|cite|improve this answer























  • 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















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.






share|cite|improve this answer























  • 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













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.






share|cite|improve this answer














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.







share|cite|improve this answer














share|cite|improve this answer



share|cite|improve this answer








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 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


















  • 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
















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


















 

draft saved


draft discarded



















































 


draft saved


draft discarded














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





















































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







Popular posts from this blog

AnyDesk - Fatal Program Failure

How to calibrate 16:9 built-in touch-screen to a 4:3 resolution?

QoS: MAC-Priority for clients behind a repeater