How can I calculate time lag using 'xcorr' for DC signals at Zero ?
3 views (last 30 days)
Show older comments
I have two DC signals, both are at zero and perfectly matched. From the theory of correlation, It won't work for zero values, because of which I am getting error in time lag and coeffiecient. Could anyone pls suggest, how could I measure similarity and time lag in this case ?
Code: [xc54,lags54] = xcorr(out_test(5,:),worst_case(5,:)); idx54 = find(lags54 == 0); Xidx54 = xc54(idx54); x_norm54 = Xidx54/(norm(out_test(5,:))*norm(worst_case(5,:)));
[~,I54] = max(abs(xc54)); % Find the index of the highest peak t54 = lags54(I54) ; % Time difference between the signals s2,s1
output: t54 = -1699 (expected value is 0) xc54 = NaN
0 Comments
Answers (0)
See Also
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!