% DANIEL BYRNE
% ECE 3133 - 01
% April 20, 1999
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%Matlab Assignment No. 6:

% A discrete signal is defined as a collection of the
% following points:

%     x(n) = {0, 1, 2, 3, 4, 5, 4, 3, 2, 1, 0}

% A system impulse response is defined by:

%     h(n) = {1, 2, 1, 0, -1, -2}

% Compute the output y(n) using the discrete convolution
% operation in matlab.

% This assignment is due by (03/23/99).
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

% Matlab Assignment No. 6 Result:

% Var

x = [0, 1, 2, 3, 4, 5, 4, 3, 2, 1, 0];
h = [1, 2, 1, 0, -1, -2];

% The discrete convolution of x and h is y.
% This function is part of the MATLAB environment. It is an M-file that uses the
% filter primitive. conv computes the convolution operation as FIR filtering
% with an appropriate number of zeros appended to the input.


y = conv(x,h);

% Analysis plots

for i = 1:3
   subplot (3,1,i);
   switch i
   case {1}
      plot (x)
      legend('x(n)')
   case {2}
      plot (h)
      legend('h(n)')
   case {3}
      plot (y)
      legend ('y(n)')
   end
   grid on
   box off
end




