In Matlab or Octave, this type of filter can be implemented
using the `filter` function. For example, the following
matlab^{4.1} code
computes the output signal `y` given the input signal
`x` for a specific example comb filter:

g1 = (0.5)^3; % Some specific coefficients g2 = (0.9)^5; B = [1 0 0 g1]; % Feedforward coefficients, M1=3 A = [1 0 0 0 0 g2]; % Feedback coefficients, M2=5 N = 1000; % Number of signal samples x = rand(N,1); % Random test input signal y = filter(B,A,x); % Matlab and Octave compatibleThe example coefficients, and , are chosen to place all filter zeros at radius and all filter poles at radius in the complex plane (as we shall see below).

The matlab `filter` function carries out the following computation
for each element of the `y` array:

for , where

[y1,state] = filter(B,A,x1); % filter 1st block x1 [y2,state] = filter(B,A,x2,state); % filter 2nd block x2 ...

[How to cite this work] [Order a printed hardcopy]

Copyright ©

Center for Computer Research in Music and Acoustics (CCRMA), Stanford University

[Automatic-links disclaimer]