function y = convo(x,h)

m = length(x);

n = length(h);

X = [x,zeros(1, m-1)];

H = [h,zeros(1,n-1)];

for r1 = 1:1:(m+n-1)

   y(r1) = 0; %creating initial y value
   for  r2 = 1:1:r1
       y(r1) = y(r1) + X(r2)*H(r1-r2+1); % summing up x[1]*h[n] + x[2]*h[n-1] ...
   end

end


OR


function y = convo(x,h) % creating a MATLAB function convo that calls upon two vectors x and h to be convoluted.

X = fft([x zeros(1,length(h)-1)]);

H = fft([h zeros(1,length(x)-1)]);

y = ifft(X.*H);

Alumni Liaison

Basic linear algebra uncovers and clarifies very important geometry and algebra.

Dr. Paul Garrett