Convolve 2 dimensional signals using the FFT.
This method is faster but less accurate than conv2 for large a and b. It also uses more memory. A small complex component will be introduced even if both a and b are real.
See also: conv2
The following code
## Draw a cross N = 100; [x,y] = meshgrid(-N:N, -N:N); z = 0*x; z(N,1:2*N+1) = 1; z(1:2*N+1, N) = 1; imshow(z); ## Draw a sinc blob n = floor(N/10); [x,y] = meshgrid(-n:n, -n:n); b = x.^2 + y.^2; b = max(b(:)) - b; b = b / max(b(:)); imshow(b); ## Convolve the cross with the blob imshow(real(fftconv2(z, b, 'same')*N))
Produces the following figure
Figure 1 |
---|
![]() |