Revision as of 00:51, 2 July 2009 by Jfmartin (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

% 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

Correspondence Chess Grandmaster and Purdue Alumni

Prof. Dan Fleetwood