|
On 15 Mar, 10:15, "Josef H" <fly...@gmail.com> wrote:
> Hello,
> I am doing cross-correlation in matlab and comparing the result with matlabs builtin 'xcorr' function. The results are pretty much the same, except that matlabs is twice the length with lots of zeros. Have I missed something important?
>
> The way I do it is; fft - conjugate - multiply - ifft
> With two signals, each with length 256, i get an output correlation result of 256 bits.
>
> with matlab xcorr function (without any extra parameters) the result is 512 bits.
>
> The waveforms look the same but the matlab correlation has more zeros and slopes when rising towards the peak. Does anyone know if my home-made cross correlation might be faulty?
Look up 'circular convolution'. When one use DFTs to compute
convolutions (cross correlation is a form of convolution)
one needs to add enough space to hold the whole result.
When convolving an M-length sequence with an N-length sequence,
the DFT length must be at least M+N-1.
Rune
|