function [ y ] = convolution( h, x ) %CONVOLUTION computes the convolution for two DT LTI signals; % y = convolution(h,x) convolves vectors h and x.; % Algebraically, convolution is the same operation as multiplying the; % polynomials whose coefficients are the elements of h and x.; % For more information, refer to the built in convolution command; % (conv)


m = length(h); n = length(x);

% y is the vector of length; y_len = m+n-1;

% corrects the lengths of the signals to be convulved; h(y_len) = 0; x(y_len) = 0;

% allocates the size of the array; y_(y_len) = 0;


for I=1:y_len

   K = 1;
   for J=I:-1:1
      y_(I) = y_(I) + h(K) * x(J);
      K = K + 1;
   end

end


y = y_;

Alumni Liaison

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

Dr. Paul Garrett