%Tyler Mattmuller

%hw2

close all

clear all

x=input('Enter first array in brackets with commas: ')

h=input('Enter second array in brackets with commas: ')

m=length(x);

n=length(h);

X=[x,zeros(1,n)];  %padding with zeros will allow for convolution to be


%preformed even if the second array is not the same size as the first array

H=[h,zeros(1,m)];

for i=1:n+m-1

Y(i)=0;

for j=1:m

if(i-j+1>0)

Y(i)=Y(i)+X(j)*H(i-j+1);

else

end

end

end

Y %output convolved array

%z=conv(x,h) %will be the same answer therefor it will have the same

%functionality this works as the matlab does not distiquish between

%stating times of the arrays given

Alumni Liaison

Ph.D. 2007, working on developing cool imaging technologies for digital cameras, camera phones, and video surveillance cameras.

Buyue Zhang