% Tune-Up Tuesday #6, Oct. 16, 2018
% Programmer: Prof. Brian L. Evans
% The University of Texas at Austin
%
% Parts (a) - (d)
h = (1/10)*ones(1, 10);
x = (1/5)*ones(1, 5);
y = conv(h, x);
n = 0 : length(y) - 1;
figure;
stem(n, y);    % looks like a trapezoid

% (e)
length(y)    % 14

% (f) Nh + Nx - 1

% (g) 
yscaled = conv(h, -x);
n = 0 : length(yscaled)-1;
figure;
stem(n, yscaled);
% Filter response is negated

% (h)
xshifted = [ 0 0 0 x ];
yshifted = conv(h, xshifted); 
n = 0 : length(yshifted)-1;
figure;
stem(n, yshifted);
% Filter response is y[n] delayed by three 

% (i) All zero input
xzeros = zeros(1, 5);
yzeros = conv(h, xzeros);
n = 0 : length(yzeros) - 1;
figure;
stem(n, yzeros);
% Filter response is zero for all samples

