Can't prove the convolution theorem of Fourier theorem for two dimensional matrices.
4 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Palguna Gopireddy
le 27 Juil 2022
Commenté : Palguna Gopireddy
le 1 Août 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 commentaires
Réponse acceptée
Abderrahim. B
le 27 Juil 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 commentaires
Paul
le 30 Juil 2022
Modifié(e) : Paul
le 31 Juil 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.
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Discrete Fourier and Cosine Transforms dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!