Thread: Stuck On Particular Question Regarding Difference Equations (Transfer Functions)

1. Stuck On Particular Question Regarding Difference Equations (Transfer Functions)

Hi all,

I am stuck on a particular question with regards to obtaining a difference equation from a given transfer function. I know how to do this in most cases, but I can't do this one:

---------------------------------------------------------------------------------------------------------

The transfer function of a certain digital filter, running at a sample rate of fs = 10kHz is given by:

$\displaystyle H(z) = (1-r) + (r^2-1)z^-2/1-2rcos(WcT)z^-1 +r^2z^-2$

Where Wc and r are constants that parameterise the filter coefficients: Wc is an angular frequency and r is a real number.

(a) what is the difference equation of this filter?

(b) Is the impulse response of this filter finite or infinite?

(c) What is the range of (real) values of r for which the filter is stable?

-----------------------------------------------------------------------------------------------------------
(Btw, Wc is "Omega small subscript c")

Here's my answer (which is drastically wrong btw):

H(z) = Y(z)/X(z)

Y(z)(1-2rcos(WcT)z^-1 + r^2z^-2) = X(z)(1-2rcos(WcT)z^-1 + r^2z^-2)

y(n) - (1-2rcos(WcT)y(n-1) + r^2y(n-2) = x(n) - rx(n) + r^2x(n-2)-x(n-2)

y(n) = x(n) - rx(n) + r^2x(n-2) - x(n-2) + 2rcos(WcT)y(n-1) + r^2y(n-2)

It's important I obtain the answer to this correctly otherwise I can't go on to do parts (b) and (c) properly.

Appreciate if anyone knows the answer to this.

2. Originally Posted by TomMUFC
Hi all,

I am stuck on a particular question with regards to obtaining a difference equation from a given transfer function. I know how to do this in most cases, but I can't do this one:

---------------------------------------------------------------------------------------------------------

The transfer function of a certain digital filter, running at a sample rate of fs = 10kHz is given by:

$\displaystyle H(z) = (1-r) + (r^2-1)z^-2/1-2rcos(WcT)z^-1 +r^2z^-2$

Where Wc and r are constants that parameterise the filter coefficients: Wc is an angular frequency and r is a real number.

(a) what is the difference equation of this filter?

(b) Is the impulse response of this filter finite or infinite?

(c) What is the range of (real) values of r for which the filter is stable?

-----------------------------------------------------------------------------------------------------------
(Btw, Wc is "Omega small subscript c")

Here's my answer (which is drastically wrong btw):

H(z) = Y(z)/X(z)

Y(z)(1-2rcos(WcT)z^-1 + r^2z^-2) = X(z)(1-2rcos(WcT)z^-1 + r^2z^-2)

y(n) - (1-2rcos(WcT)y(n-1) + r^2y(n-2) = x(n) - rx(n) + r^2x(n-2)-x(n-2)

y(n) = x(n) - rx(n) + r^2x(n-2) - x(n-2) + 2rcos(WcT)y(n-1) + r^2y(n-2)

It's important I obtain the answer to this correctly otherwise I can't go on to do parts (b) and (c) properly.

Appreciate if anyone knows the answer to this.
Use brackets!

I presume you mean:

$\displaystyle H(z) = \frac{(1-r) + (r^2-1)z^{-2}}{1-2r \cos(\omega_cT)z^{-1} +r^2z^{-2}}$

Then:

$\displaystyle \left[1-r) + (r^2-1)z^{-2}\right]X(z)=\left[1-2r \cos(\omega_cT)z^{-1} +r^2z^{-2}\right]Y(z)$

Where $\displaystyle X(z)$ is the $\displaystyle z$-transform of the input and $\displaystyle Y(z)$ the $\displaystyle z$-transform of the output.

CB

3. Hi Captain Black thanks for the response,

To be honest with you I had that first line, I just wrote it out wrong (sorry my mistake).

But it's from there that I get confused with.

So following from what you wrote, I wonder if you could help me, is it

$\displaystyle y(n) - (1-2rcos(\omega_cT)y(n-1) + r^2y(n-2) = x(n) - rx(n) + r^2x(n-2)-x(n-2)$

Rearranging for the output y(n)

$\displaystyle y(n) = x(n) - rx(n) + r^2x(n-2) - x(n-2) + 2rcos(\omega_cT)y(n-1) + r^2y(n-2)$

Do I multiply out all the constituent parts individually including the real part r? Really confused.

It's just that it's obviously important or I can't do parts b and c, I'm sure that's not correct anyhow. Btw it's 1-2rcos...which you missed out on your main bracket on the right hand side.

4. Originally Posted by CaptainBlack
Use brackets!

I presume you mean:

$\displaystyle H(z) = \frac{(1-r) + (r^2-1)z^{-2}}{1-2r \cos(\omega_cT)z^{-1} +r^2z^{-2}}$

Then:

$\displaystyle \left[1-r) + (r^2-1)z^{-2}\right]X(z)=\left[1-2r \cos(\omega_cT)z^{-1} +r^2z^{-2}\right]Y(z)$

Where $\displaystyle X(z)$ is the $\displaystyle z$-transform of the input and $\displaystyle Y(z)$ the $\displaystyle z$-transform of the output.

CB
Which becomes:

$\displaystyle (1-r)x(n)+(r^2-1)x(n-2)=y(n)-2r\cos(\omega_cT)y(n-1)+r^2y(n-2)\$

CB

5. Hi CaptainBlack,

Just while we're at it, I have attempted parts (b) and (c) of this question:

(b) - The impulse response of the filter is infinite because it contains feedback (i.e. there is an output term).

(c) I have some problems answering this, infact it's probably the maths that is letting me down.

Ok so from the the specified transfer function we know two things:

- We can obtain poles by setting the denominator to zero.
- A filter is stable once all poles lie within the unit circle (i.e. modulus of 1)

So,

$\displaystyle 1-2rCos(\omega_cT)z^-1 + r^-2$

Multiplying this line to positive values of z

$\displaystyle z^2-2rCos(\omega_cT)z^1 +r^2$

I have reassurance from my lecturer that it can be solved (r that is) using the quadratic equation:

a=1
b=$\displaystyle 2rcos(\omega_cT)$
c=$\displaystyle r^2$

But this where I fall on, and where I need help,

$\displaystyle (2rcos(\omega_cT) +/- [sqrt](-(2rcos(\omega_cT))^2-4r^2)$

all divided by 2

I can change the $\displaystyle b^2$ in the brackets to become = $\displaystyle 4r^2cos^2(\omega_cT)$ but then I've become snookered. Can you help? We're effectively solving for r.

Apologies my Mathtags are terrible! (Can't do the quadratic properly lol)