How to shift from convolution product to the scalar product with arrays?
3 views (last 30 days)
Show older comments
hy guys, hope you are doing well
I know that the product of the 2 signals in the frequency domain is equal to the Fourier transform of their convolution in the time domain
Y(f)= x(f). h(f)= fft( conv( x(t), h(t))
However, I tried to do the same in 2d with array and I didn't get the same result, i expected that the plot in subplot(244) would be equal to the plot in subplot(247)
Any idea how to fix it ?
Thank you in advance
code:
clear all
clc
n=3;
m=5;
a=rand(n,m)
b=rand(n,m)+1i*rand(n,m);
c=conv2(a,b);
subplot(241)
pcolor(abs(a))
title('a')
subplot(242)
pcolor(abs(b))
title('b')
subplot(243)
pcolor(abs(c))
title('c=conv2(a,b)')
subplot(244)
pcolor(abs(fftshift(fft2(c,n,m))))
title('fft2(c)')
subplot(245)
tfa=fftshift(fft2(a))
pcolor(abs(tfa))
title('tfa')
subplot(246)
tfb=fftshift(fft2(b))
pcolor(abs(tfb))
title('tfb')
subplot(247)
tfab=tfa.*tfb;
pcolor(abs(tfab))
title('tfa.*tfb')
0 Comments
Answers (0)
See Also
Categories
Find more on Subplots in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!