File Exchange

image thumbnail

CONV2 Overlap-add Method

version (4.43 KB) by Luigi Rosa
Overlap-add method of CONV2 using FFT2.


Updated 19 Jan 2004

View License

CONV2OLAM Overlap-add method of CONV2 using FFT2.

See readme.txt for more informations.

Please contribute if you find this software useful.

Report bugs to

Luigi Rosa
Via Centrale 27
67042 Civita di Bagno
L'Aquila --- ITALY
mobile +39 340 3463208

Cite As

Luigi Rosa (2020). CONV2 Overlap-add Method (, MATLAB Central File Exchange. Retrieved .

Comments and Ratings (10)

Ahmed Fasih

I've added a small enhancement to make the function work for arrays of size 2^17 per side, instead of 2^12: see

If you need more than 2^17, just increase the `Nnew` in the code from 5 to whatever you need. That 5 there means add five more powers-of-two to the lookup table, which already has 13 entries, i.e., expand support for 2^12 to 2^17.

Ahmed Fasih

Fails for large input "a". Why?

`conv2olam(randn(8*1024), randn(2))`

If the first argument has size <=4096, conv2olam succeeds.


Amazing work. Very helpful. Thanks a lot

Stephan Koehler

Incredibly fast. I use conv2 a lot, and replacing with conv2olam makes calculations much, much faster.

Here is a snippet of code to return the same output as conv2(a, b, 'valid' ):

out = conv2olam( a, b );
out = cnv_cone2( floor(length(b)/2)+[1:size(a,1)], floor(length(b)/2) + [1:size(a,2)] );


They way i understand it it can only handle matrices with a maximum size of 2.^13 = 8192. It would be nice if bigger matrices would work as well.

Kiran Bhagat

Beautiful work...

Usman Khan

Excellent work. Must be appriciated.

Jason Jury

Nice straightforward m-file. Benchmarked on AMD-64 with Linux. Run time for convolving 2 500x500 matrices (with zero-padding) was 1.5 seconds; same problem with 'conv2' command took 490 seconds. For large problems with conv2olam, the run time scales as N^(2.2), for NxN square matrices. With conv2, run time scales as N^(4.6).

uuu uuu


Ila Fiete

This is a simple code for 2-d convolution, based on the built-in matlab routine for 2-d fft. You can write it easily yourself, but this code is pretty clean and straightforward.

For large matrices, filter2 or conv2 are v. slow in matlab for large matrices. This code leads to a considerable speedup, by a factor of 5-10 on my machine, when I convolve a 500^2 matrix with a 100^2 one.


Software Upgraded: Speed optimized

MATLAB Release Compatibility
Created with R13
Compatible with any release
Platform Compatibility
Windows macOS Linux