MATLAB Answers

Find position of smaller waveform within a longer noise waveform.

1 view (last 30 days)
Philip
Philip on 18 Apr 2012
I am searching for a short waveform within a longer noisy waveform. What is the best way to find the location within the longer waveform of the best fitting match to the short waveform? I have played with xcorr and conv and look for position of maximum value, but translating from the position in the xcorr result to the position in the long waveform is causing me problems. I also have problems if the amplitude in the long waveform varies widely from position to position.

  4 Comments

Show 1 older comment
Philip
Philip on 18 Apr 2012
% vmatch is short waveform
% v is longer noisy waveform containing vmatch
tmp=xcorr(vmatch,v);
[maxxc,maxitmp]=max(tmp);
t_start=max(length(v),length(sbvmatch))-maxitmp;

Sign in to comment.

Answers (1)

Roshin Kadanna Pally
Roshin Kadanna Pally on 19 Apr 2012
You can try the following:
Normalize your sequences as shown below:
v = (v - mean(v))/std(v,1);
Make the two sequences of equal length by zero padding and use:
[C,lag] = xcorr(v,vmatch,'unbiased')

  0 Comments

Sign in to comment.

Sign in to answer this question.