Advertisement
Guest User

Syncing data with xcov

a guest
Feb 19th, 2014
189
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
MatLab 0.31 KB | None | 0 0
  1. offset = 150;
  2.  
  3. a = rand(1, 500);
  4. b = a(1 : end - offset) + rand(1, numel(a) - offset);
  5. c = a(offset + 1 : end) + rand(1, numel(a) - offset);
  6.  
  7. close all
  8. figure
  9.  
  10. plot(1:numel(b), b);
  11. hold on
  12. plot(1:numel(c), c, 'r');
  13.  
  14. [crossCorr] = xcov(b, c);
  15. [~, peakIndex] = max(crossCorr())
  16. offset = peakIndex - length(b)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement