How can I perform cyclic (periodic) convolution between two matrices in Matlab? And also, what would be the normalization term?

  • $\begingroup$ What have you tried? What are you having trouble with? Is there something missing from the documentation? $\endgroup$ Commented Feb 2, 2018 at 16:45
  • $\begingroup$ There only seem to be a function called cconv for vectors that doesn't work for matrices. $\endgroup$ Commented Feb 2, 2018 at 17:01
  • $\begingroup$ a matrix in matlab can be 1D, 2D or nD. I think you have a 2D matrix, that's why you cannot use conv directly ? $\endgroup$
    – Fat32
    Commented Feb 2, 2018 at 17:25
  • $\begingroup$ Yes, I got a 2D matrix. $\endgroup$ Commented Feb 2, 2018 at 19:03

1 Answer 1


Assuming that cconv2 does not exist, you can do it with the Fourier transform and multiplication:

A = some_MxN_matrix;
B = some_KxP_matrix;
Mfft = max(M,K);
Nfft = max(N,P);
C = ifft2( fft2(A,Mfft,Nfft) .* fft2(B,Mfft,Nfft) );

Hopefully the above helps.

  • $\begingroup$ Thanks. Is there any normalization factor I should take into account? $\endgroup$ Commented Feb 2, 2018 at 19:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.