Thursday 17 April 2014

Matlab program for convolution of two sequences simple example

%convolution

clear all;
clc;

h=[1 2 3 4];
x=[1 2 1];

h1=[zeros(1,3) h];
x=fliplr(x);

for i=1:7
    x1=[zeros(1,i-1),x,zeros(1,7)];
    x1=x1(1:7);
    y(i)=sum(x1.*h1);
end

disp(y(2:end));


Reference links:

http://en.wikipedia.org/wiki/Convolution
http://terpconnect.umd.edu/~toh/spectrum/Convolution.html
http://www.jhu.edu/~signals/convolve/
http://dsp.stackexchange.com/questions/4723/what-is-the-physical-meaning-of-the-convolution-of-two-signals

No comments:

Post a Comment