Can't prove the convolution theorem of Fourier theorem for two dimensional matrices.

3 views (last 30 days)
I multiplied two 2D matrices.A, B
A=[1 2;1 1];
B=[1 2;2 1];
C=A.*B;
I convolved their respective DFTs of 512*512 samples each by using the code given in https://in.mathworks.com/matlabcentral/answers/1665734-how-to-perform-2-dimensional-circular-convolution?s_tid=srchtitle
A_fft2=fft2(A,512,512);
B_fft2=fft2(B,512,512);
C_fft2_cconv2=circular_conv(A_fft2, B_fft2);
I found the IDFT of C_fft2; and applied DFT on C
C_ifft2=ifft2(C_fft2);
C_fft2=fft2(C,512,512);
Acoording to fourier theorem
C_ifft2(1:2,1:2) should be equal to C;
C_fft2 should be equal to C_fft2_cconv2.
But neither are them are same in the results.
Could someone tell how to get it.

Accepted Answer

Issa
Issa on 27 Jul 2022
Hi!
Please read about discrete convolution ....
Perhaps this:
Conv, fft and ifft
x = randi(10, 20, 1);
y = randi(20,20,1);
n = length(x)+length(y)-1;
xConvFFt = ifft(fft(x,n).*fft(y,n)) ;
xConv = conv(x,y) ;
% compare
isequal(round(conv(x,y), 4), round(xConv, 4))
ans = logical
1
Conv2, fft2 and ifft2
x = randi(10, 20, 10);
y = randi(20,20,10);
m = length(x)+length(y)-1;
n = length(x) - 1;
xConvFFt2 = ifft2(fft2(x,m, n).*fft2(y,m, n)) ;
xConv2 = conv2(x,y) ;
% compare
isequal(round(xConvFFt2), round(xConv2))
ans = logical
1
HTH
  5 Comments

Sign in to comment.

More Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by