octave-maintainers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Fwd: Potential serious problem with xcorr


From: Mike Miller
Subject: Re: Fwd: Potential serious problem with xcorr
Date: Mon, 1 Apr 2019 17:54:25 -0700
User-agent: Mutt/1.10.1 (2018-07-13)

On Tue, Apr 02, 2019 at 00:42:56 +0200, JuanPi wrote:
> maybe offer
> xcorr_periodic or something like that for the case in which the
> signals are periodic?

I forgot about this last part of your message. The simplest and fastest
way to compute the circular cross-correlation today is with 'fft'.

Continuing with your example

    corr_fft = ifft (fft (x) .* conj (fft (y)));
    corr_circ = real ([corr_fft(2:end); corr_fft]);

This agrees with the circular cross-correlation you computed using
'arrayfun' and 'circshift'.

You can also use the function 'cconv' to compute the same thing

    cc = cconv (x, conj (flip (y)), length (x));
    cc = circshift (cc, 1);
    corr_circ2 = real ([cc(2:end); cc]);

I would be in favor of documenting ways to compute a circular
cross-correlation using 'fft' and/or 'cconv'.

-- 
mike



reply via email to

[Prev in Thread] Current Thread [Next in Thread]