Revision as of 23:48, 1 July 2009 by Jfmartin (Talk | contribs)

% Jamis Martin % ECE301 - HW2 % Convolution Program

close all

clear all

x = input('Enter first array x[n] (ex: [1 2 3 .. n]): ');

h = input('Enter second array y[n] (ex: [1 2 3 .. n]): ');

len_x = length(x);

len_h = length(h);

len_y = len_x + len_h - 1;

x = [x, zeros(1, len_x)];

h = [h, zeros(1, len_h)];

y = zeros(1, len_y);

for(a = 1:len_y)

for(b = 1:len_x)

if(a - b + 1 > 0)

y(a) = y(a) + x(b) * h(a - b + 1);

end

end

end

%Display the answer y = x * h y

Alumni Liaison

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

Dr. Paul Garrett