[SciPy-User] fft convolutions

Sturla Molden sturla at molden.no
Thu Jun 30 09:54:29 EDT 2011


Den 30.06.2011 14:26, skrev Sebastian Berg:
> Hi,
>
> I assume its *a inside the loop, but don't you have to conjugate one of
> the two?

No, he just has to multiply in rectangular form.

He might be confused by circular connvolution though.

 >>> import numpy as np
 >>> a = np.zeros(100)
 >>> b = np.zeros(100)
 >>> a[1] = 1
 >>> b[:10] = 2

 >>> np.convolve(a,b)
array([ 0.,  2.,  2.,  2.,  2.,  2.,  2.,  2.,  2.,  2.,  2.,  0.,  0.,

 >>> np.round(np.fft.ifft(np.fft.fft(a)*np.fft.fft(b)).real)
array([ 0.,  2.,  2.,  2.,  2.,  2.,  2.,  2.,  2.,  2.,  2.,  0.,  0.,


Sturla













More information about the SciPy-User mailing list