Prev: READING TEXT BOX VALUE....
Next: Bilevel optimization
From: Greg Heath on 10 Apr 2010 21:19 On Apr 9, 7:05 am, Rune Allnor <all...(a)tele.ntnu.no> wrote: > On 9 apr, 12:24, "Michal Kotze" <mkotz...(a)yahoo.de> wrote: > > > I know this is to do with using the max function and the floating point representation of values. > > No, it isn't. > > The problem is that the cross correlation produces a discrete > series, and a naive search for the maximum amplitude will be > constrained to the discrete delays. If the actual delay is > not an integer number of samples, there will be poblems. > > You might want to refine your delay estimates by investigating > the phase of the cross spectrum. Rune, I have not been able to get anywhere with this. If Rxy = fft(rxy), is it a simple matter of dividing angle(Rxy) at the peak of abs(Rxy) by 2*pi*f? Greg
From: Mark Shore on 11 Apr 2010 08:40 A more appropriate signal to examine cross-correlation the way I'm guessing Michal wants would be something along the lines of : k=400; m=10; n=20; p=50; % m sine wave cycles with n samples/cycle padded with k leading and trailing zeros CH1=[zeros(1,k) repmat(sin(2*pi/n*(1:n)),1,m) zeros(1,k)]; % shift CH1 by p sample intervals CH2=[CH1(p:end) CH1(1:p-1)]; % no 1D equivalent of circshift in MATLAB(?) plot(CH1,'b'); hold on; plot(CH2,'r'); hold off % optional plot He should also consider the limiting case of a vector with a single non-zero value, say [1 zeros(1,999)] and its cross-correlation with a shifted equivalent.
From: Michal Kotze on 12 Apr 2010 04:04 Thanks Greg and Mark for your replies and for looking into my problem. Greg and Mark I will answer you questions soon but i am a bit busy now at university. Check the post round about Wednesday, 14 April 2010. Regards Michal Kotze
From: Greg Heath on 12 Apr 2010 04:45 On Apr 10, 9:19 pm, Greg Heath <he...(a)alumni.brown.edu> wrote: > On Apr 9, 7:05 am, Rune Allnor <all...(a)tele.ntnu.no> wrote: > > > On 9 apr, 12:24, "Michal Kotze" <mkotz...(a)yahoo.de> wrote: > > > > I know this is to do with using the max function and the floating point representation of values. > > > No, it isn't. > > > The problem is that thecrosscorrelationproduces a discrete > > series, and a naive search for the maximum amplitude will be > > constrained to the discrete delays. If the actual delay is > > not an integer number of samples, there will be poblems. > > > You might want to refine your delay estimates by investigating > > the phase of thecrossspectrum. > > Rune, > > I have not been able to get anywhere with this. If Rxy = fft(rxy), > is it a simple matter of dividing angle(Rxy) at the peak of > abs(Rxy) by 2*pi*f? OK. I see it now: Ideally g = ifft(exp(i*angle(Rxy)) should yield a pulse whos position represents the time delay. M = length(Rxy) t = dt*(0:2*M-1); [ gmax jmax0] = max(g) % [ 1 1500] delay = max(t)-t(jmax0) % 0.5 sec Greg
From: Greg Heath on 12 Apr 2010 04:49 On Apr 12, 4:45 am, Greg Heath <he...(a)alumni.brown.edu> wrote: > On Apr 10, 9:19 pm, Greg Heath <he...(a)alumni.brown.edu> wrote: > > > > > > > On Apr 9, 7:05 am, Rune Allnor <all...(a)tele.ntnu.no> wrote: > > > > On 9 apr, 12:24, "Michal Kotze" <mkotz...(a)yahoo.de> wrote: > > > > > I know this is to do with using the max function and the floating point representation of values. > > > > No, it isn't. > > > > The problem is that thecrosscorrelationproduces a discrete > > > series, and a naive search for the maximum amplitude will be > > > constrained to the discrete delays. If the actual delay is > > > not an integer number of samples, there will be poblems. > > > > You might want to refine your delay estimates by investigating > > > the phase of thecrossspectrum. > > > Rune, > > > I have not been able to get anywhere with this. If Rxy = fft(rxy), > > is it a simple matter of dividing angle(Rxy) at the peak of > > abs(Rxy) by 2*pi*f? > > OK. I see it now: Ideally > > g = ifft(exp(i*angle(Rxy)) > > should yield a pulse whos position represents the time delay. > > M = length(Rxy) > t = dt*(0:2*M-1); > [ gmax jmax0] = max(g) % [ 1 1500] > delay = max(t)-t(jmax0) % 0.5 sec For the test case f0 = 1 x0 = sin(2*pi*f0*t0) ; x1 = [x0 zeros(1,N)]; x2 = [zeros(1,N/2) x0 zeros(1,N/2)]; t = dt*(0:2*N-1); Greg
First
|
Prev
|
Next
|
Last
Pages: 1 2 3 4 Prev: READING TEXT BOX VALUE.... Next: Bilevel optimization |