Is ifft(fft(x).*fft(h)) faster or conv(x,h) ?

57 views (last 30 days)
Alim Huseynov
Alim Huseynov on 1 Dec 2017
Commented: Rik on 11 Mar 2020
Dear All,
I need to find out which one is faster to obtain convolution? - Linear convolution using just 'conv'? - or Obtaining Convolution from ifft(fft)? As far as I have coded and identified using tic/toc, that Matlab performs linear convolution faster than ifft(fft). But textbooks say fft is faster.
  4 Comments
Rik
Rik on 11 Mar 2020
Just a note: format LONGENG will not increase calculation precision, it will only affect how values are shown in the command window.

Sign in to comment.

Answers (2)

Rik
Rik on 11 Mar 2020
Why would a textbook say ifft(fft()) is faster? That doens't make sense. If that was the case, Mathworks would have implemented conv a bit like this:
function out=conv(x,h)
out=ifft(fft(x).*fft(h));
end
The mere fact that they didn't should tell you the real conv function is faster than the one I put here.

Honglei Chen
Honglei Chen on 11 Mar 2020
Time is not the best way to compare the two approaches. Rather, the best approach to describe is the computation complexity, i.e., when the size of the signal increases, how does the time of computation increases accordingly. It is in this comparison that the FFt approach shows the advantage. The theory should be available in any standard DSP text book and here is a webpage for a summary
HTH
  1 Comment
Rik
Rik on 11 Mar 2020
I would expect the implementation in Matlab to be a black box: it is not relevant if internally there is an FFT or direct approach, as long as it gives the correct output. That is true in general for internal functions. Your comment about computational complexity still holds, but I expect the Mathworks employees that engineered the conv function to know about this.

Sign in to comment.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!