Reply by kimt...@gmail.com●March 29, 20092009-03-29
Thank you Martin!
That was just what I needed. I don't understand how I failed to see
that passing it to the z-domain would give me three equations and
three unknowns/ a single variable for each signal. I guess I oversaw
one of the key ideas behind transformations.
/Kim
Reply by Martin Eisenberg●March 29, 20092009-03-29
kimtherkelsen@gmail.com wrote:
> I have implemented the filter (in software) based on the diagram
> in: http://www.earlevel.com/Digital%20Audio/StateVar.html
>
> Now I want to derive the transfer function from the diagram and
> find out how f and q (see the link) are related to the
> b-coefficients in:
>
> H(z) a0 + a1*z^-1 + a2*z^-2
> = ------------------------
> 1 - b1*z^-1 - b2*z^-2
> ylp(n) = ylp(n-1)+f*ybp(n-1)
> yhp(n) = x(n) - ylp(n)-q*ybp(n-1)
> ybp(n) = f*yhp(n)+ybp(n-1)
>
> but the problem is I now have three equations with more than
> three unknowns and also I need to get some x[n-1] etc. into the
> equation.
Pass to the z-domain to get a single variable for each signal.
Omitting arguments in L = L(z) etc. for brevity, your equation system
becomes
L = L/z + f*B/z
H = X - L - q*B/z
B = f*H + B/z.
Note that in this form, the highpass transfer function is not H but
H/X. Isolate L and B and eliminate them from the second equation:
L = f*B/z/A, A = 1-1/z = (z-1)/z
B = f*H/A;
H = X - B/z*(f/A + q)
= X - H*f/A/z*(f/A + q).
From that, isolate H, expand the polynomials, and finally augment the
fraction by 1/z^2 to identify the coefficients:
H = X / (1 + f/A/z*(f/A + q))
= X * (z-1)^2/(z^2 + (f^2 + f*q - 2)*z + 1-f*q),
so a = (1,-2,1) and b = (1, 2-f^2-f*q, f*q-1).
Martin
--
Sufficiently encapsulated magic is
indistinguishable from technology.
Reply by kimt...@gmail.com●March 29, 20092009-03-29
Hi,
I am comparing coefficient quantization errors for second order IIR
filter structures (for fixed point implementation). I have found the
Chamberlin state variable structure to perform well at low frequencies
and have seen in the article "The modified Chamberlin and Z�lzer
filter structures" that the quantized pole distribution is dense in
the low frequency area of the unit circle in the z-plane.
I have implemented the filter (in software) based on the diagram in:
http://www.earlevel.com/Digital%20Audio/StateVar.html
Now I want to derive the transfer function from the diagram and find
out how f and q (see the link) are related to the b-coefficients in:
H(z) a0 + a1*z^-1 + a2*z^-2
= ------------------------
1 - b1*z^-1 - b2*z^-2
Then I will find the relation to the poles and make my own quantized
pole distribution plot.
From the diagram I can see that the following simple implementation
can be used (working matlab code, only HP filteret samples are saved):
low = 0;
high = 0;
band = 0;
y = zeros(length(x),1);
for i = 1:length(x)
low = low + f * band;
high = x(i) - low - q * band;
band = f * high + band;
y(i) = high;
end
I have then tried rewriting it to something like this:
ylp(n) = ylp(n-1)+f*ybp(n-1)
yhp(n) = x(n) - ylp(n)-q*ybp(n-1)
ybp(n) = f*yhp(n)+ybp(n-1)
but the problem is I now have three equations with more than three
unknowns and also I need to get some x[n-1] etc. into the equation. I
have tried doing some substitution and for instance turned up with:
ybp(n) = -f*ylp(n-1)+f*x(n)-(f^2+f*q-1)*ybp(n-1)
Then by looking at the diagram I tried to express ylp(n-1) by some by
some x(n-...), f and q's but as it is recursive I can't (don't know
how to) do that.
There must be some mathematical trick or sequency knowledge I should
know?
Best regards,
Kim