EE 451

Example 4.1.7 from Orfanidis

G = 0.1;
h=G*ones(1,15);		%h(n) = {G,G,...G} - 15 terms
yds = sum(h);

%Generate square wave, L = 200, period K = 50 samples
L=200;
K = 50;
n=0:L-1;
x = [mod(n,K)<K/2];

%convolve the square wave with h(n)
y = conv(h,x);
plot(n,y(1:length(n)))
hold on
plot(n,x,'--')
axis([0 200 -0.5 2.5])
xlabel('time samples')
legend('-','output','--','input')