Can't prove the convolution theorem of Fourier theorem for two dimensional matrices.
4 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Palguna Gopireddy
il 27 Lug 2022
Commentato: Palguna Gopireddy
il 1 Ago 2022
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.
0 Commenti
Risposta accettata
Abderrahim. B
il 27 Lug 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))
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))
HTH
5 Commenti
Paul
il 30 Lug 2022
Modificato: Paul
il 31 Lug 2022
When approximating an integral with a sum, the sum needs to be scaled by dtheta.
format short e
a2=[1 2 1 3];
b2=[2 3 2 1];
c2=a2.*b2
For N = 512
N = 512;
dtheta = 2*pi/N;
c2f_cconv_dft=(1/(2*pi))*cconv(fft(a2,N),fft(b2,N),N)*dtheta;
Note that 2*pi cancels, so better to just do
c2f_cconv_dft=cconv(fft(a2,N),fft(b2,N),N)/N;
c2f_cconv_idft=ifft(c2f_cconv_dft,512);
The first four points "match"
c2f_cconv_idft(1:4)
The rest of the points are "zero"
max(abs(c2f_cconv_idft(5:end)))
I think this example is actually demonstrating circular convolution theorem of the DFT or its dual, which should be closely related to the convolution property of the DTFT.
Più risposte (0)
Vedere anche
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!