Circular convolution in MATLAB

I had been breaking my head over convolution for the past one week, and last night there was the revelation I had been waiting for. After that moment of truth, I no longer know why it took so much time-what was there not to understand?

Anyway, once I had nailed convolution, I figured out a neat way to implement circular  convolution in MATLAB. For convolution of 2 sequences of length n, this will give the desired result:

for i=1:n

out=out + input1(i)*input2;

input2=circshift(input2,[0 1]);

end %end of for building convolved sequence.

Figuring that out kind of made my day today. This is what Richard Feynman called “The Pleasure of Finding Things Out”.

This entry was posted in Notes and tagged , , . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s