```dazedandconfused wrote:

> I'm an computer engineering undergrad with what is probably a
> simple filter question.
>
> I need to simulate in Matlab and provide a mathematical analysis
> of a bandpass filter by cascading a comb filter with a
> resonator. The comb has transfer function:
>
> Hc(z) = 1 + r^m*z^-m
>
> and the resonator:
>
> Hr(z) = z^2/(z^2 - 2*r*cos(omega)*z + r^2)
>       = z^2/((z - r*exp(j*omega))(z - r*exp(-j*omega)))
>
> where r = 0.999
>       m = 250
>       omega = (9*pi)/250
>
> I've managed to implement the filter in Matlab using the filter
> function and supplying the coefficients for B and A. The problem
> I'm having is that I'm unable to work out the gain of the filter
> in my analysis.

Presumably, you want not the magnitude function but the peak gain. To
estimate the peak location, note that the resonator peaks at
approximately omega (as long as omega stays reasonably clear of 0 and
pi) and that omega minimizes the comb's magnitude function. So the
magnitude product also has a root close to omega. At omega, the
squared gain is about 962200 -- not too far from the graphically
observed squared peak gain of about 965800 at a frequency slightly
below omega (due to pole proximity).

Martin

--
Quidquid latine scriptum sit, altum viditur.
```
```dazedandconfused wrote:

> Hi,
>
> I'm an computer engineering undergrad with what is probably a simple
> filter question.
>
> I need to simulate in Matlab and provide a mathematical analysis of a
> bandpass filter by cascading a comb filter with a resonator. The comb has
> transfer function:
>
> Hc(z) = 1 + r^m*z^-m
>
> and the resonator:
>
> Hr(z) = z^2/(z^2 - 2*r*cos(omega)*z + r^2)
>       = z^2/((z - r*exp(j*omega))(z - r*exp(-j*omega)))
>
> where r = 0.999
>       m = 250
>       omega = (9*pi)/250
>
> I've managed to implement the filter in Matlab using the filter function
> and supplying the coefficients for B and A. The problem I'm having is that
> I'm unable to work out the gain of the filter in my analysis. I've been
> working on this for days and can't find a solution. If anyone could
> provide any insights, a process to follow or even a solution I'd be really
> gratefull.
>
>
>
* Choose a frequency.  In sampled time it'll just be normalized to
theta = angle/sample.
* Calculate w = e^(i*theta) = cos(theta) + i*sin(theta)
* Solve for gain = Hr(w) * Hc(w).
* Find the magnitude of gain.

You do know complex numbers, right?

--

Tim Wescott
Wescott Design Services
http://www.wescottdesign.com

"Applied Control Theory for Embedded Systems" came out in April.
See details at http://www.wescottdesign.com/actfes/actfes.html
```
```Hi,

I'm an computer engineering undergrad with what is probably a simple
filter question.

I need to simulate in Matlab and provide a mathematical analysis of a
bandpass filter by cascading a comb filter with a resonator. The comb has
transfer function:

Hc(z) = 1 + r^m*z^-m

and the resonator:

Hr(z) = z^2/(z^2 - 2*r*cos(omega)*z + r^2)
= z^2/((z - r*exp(j*omega))(z - r*exp(-j*omega)))

where r = 0.999
m = 250
omega = (9*pi)/250

I've managed to implement the filter in Matlab using the filter function
and supplying the coefficients for B and A. The problem I'm having is that
I'm unable to work out the gain of the filter in my analysis. I've been
working on this for days and can't find a solution. If anyone could
provide any insights, a process to follow or even a solution I'd be really
gratefull.

```