Hi,

I am an FPGA engineer , new to MATLAb and DSP , and immersed in DSP study.
Today's exercise is plotting the unit impulse response for a Comb filter of the
form:

yc(n) = x(n) - x(n-4)

I wrote the following code:

n1 = 0;

n0 = 10; % t = 0

n2 = 100; % n2 - n1 = Length of impulse response in vector

[x,n] = impseq(n0,n1,n2); % Generates unit impulse sequences, x(n0) = 1, others
0

% Difference equation (const coeficcients: y(n) = sum(bm*x(n-m) -
sum(ak*y(n-k)

% Comb filter : yc(n) = x(n) - x(n-4) => b(1) = 1 , b(4) =-1 , y(1) = 1

a = [1,zeros(1,n2-1)] ; % feedback coefficients

b = [1,0,0,-1,zeros(1,n2-4)]; % Comb polinomial equation

yc_imp = filter(b,a,x)

The code above gives a response with yc_imp(n0) = 1, yc_imp(n0+4) = -1 and the
rests zero. I would expect to get an oscillatory behavior with 4 samples
period.

What' s the trick I am missing here?

zermelo