Solution of Difference Equations Using Z-Transform



Z-Transform

The Z-transform is a mathematical tool used to convert difference equations in the discrete-time domain into algebraic equations in the z-domain. Mathematically, if x(n) is a discrete-time function, its Z-transform is defined as −

$$\mathrm{Z[x(n)] \:=\: X(z) \:=\: \sum_{n=-\infty}^{\infty} \:x(n) z^{-n}}$$

Solving Difference Equations by Z-Transform

In order to solve the difference equation, first it is converted into the algebraic equation by taking its Z-transform. Then, the solution of the equation is calculated in z-domain and finally, the time-domain solution of the equation is obtained by taking its inverse Z-transform.

Note − The various responses of a system are −

  • Forced Response: When the initial conditions are neglected, the response of the system due to input alone is called the forced response of the system.
  • Natural Response: When the input is neglected, the response of the system due to initial conditions alone is called the natural response of the system.
  • Total Response: The response of the system due to initial conditions and input considered simultaneously is called the total response of the system.
  • Impulse Response: When the input to the system is a unit impulse signal, the response of the system is called the impulse response of the system.
  • Step Response: When the input to the system is a unit step signal, the response of the system is called the step response of the system.

Numerical Example

A discrete-time LTI system is described by the following difference equation −

$$\mathrm{y(n) \:-\: \frac{3}{4}y(n\:-\:1) \:+\: \frac{1}{8}y(n\:-\:2) \:=\: x(n) \:+\: x(n\:-\:1)}$$

Also, it is given that y(-1) = 0 and x(-2) = -1. Then, find −

  • The natural response of the system
  • The forced response of the system

Solution 1: Natural Response of The System

As the natural response of the system is the response due to the initial conditions only, for the natural response, x(n) = 0. Therefore, the difference equation of the given system becomes −

$$\mathrm{y(n) \:-\: \frac{3}{4}y(n\:-\:1) \:+\: \frac{1}{8}y(n\:-\:2) \:=\: 0}$$

Now, taking the Z-transform of the above equation, we get −

$$\mathrm{Z\left[y(n) \:-\: \frac{3}{4}y(n\:-\:1) \:+\: \frac{1}{8}y(n\:-\:2)\right] \:=\: 0}$$

$$\mathrm{\Rightarrow\:Y(z) \:-\: \frac{3}{4}[z^{-1}Y(z) \:+\: y(-1)] \:+\: \frac{1}{8}[z^{-2}Y(z) \:+\: z^{-1}y(-1) \:+\: y(-2)] \:=\: 0}$$

Given that y(-1) = 0 and y(-2) = -1, we have −

$$\mathrm{\therefore\:-Y(z)\left(1 \:-\: \frac{3}{4}z^{-1} \:+\: \frac{1}{8}z^{-2}\right) \:-\: \frac{1}{8} \:=\: 0}$$

$$\mathrm{\therefore\:Y(z) = \frac{\frac{1}{8}}{\left(1 \:-\: \frac{3}{4}z^{-1} \:+\: \frac{1}{8}z^{-2}\right)} \:=\: \frac{\left(\frac{1}{8}\right)z^2}{z^2 \:-\: \frac{3}{4}z \:+\: \frac{1}{8}}}$$

$$\mathrm{\Rightarrow\:Y(z) = \frac{\left(\frac{1}{8}\right)z^2}{\left(z \:-\: \frac{1}{2}\right)\left(z \:-\: \frac{1}{4}\right)}}$$

By taking the partial fraction, we get −

$$\mathrm{\frac{Y(z)}{z}\:=\:\frac{\left(\frac{1}{8}\right)z}{\left(z \:-\: \frac{1}{2}\right)\left(z \:-\: \frac{1}{4}\right)} \:=\: \frac{A}{\left(z \:-\: \frac{1}{2}\right)} \:+\: \frac{B}{\left(z \:-\: \frac{1}{4}\right)}}$$

$$\mathrm{\Rightarrow\:\frac{Y(z)}{z} \:=\: \frac{\frac{1}{4}}{\left(z \:-\: \frac{1}{2}\right)} \:-\: \frac{\frac{1}{8}}{\left(z \:-\: \frac{1}{4}\right)}}$$

$$\mathrm{\therefore\:Y(z)\:=\:\frac{z}{4\left(z\:-\:\frac{1}{2}\right)}\:-\:\frac{z}{8\left(z\:-\:\frac{1}{4}\right)}}$$

Now, to obtain the natural response of the system, we take the inverse Z-transform on both sides −

$$\mathrm{Z^{-1}[Y(z)] \:=\: Z^{-1}\left[\frac{z}{4\left(z \:-\: \frac{1}{2}\right)}\right] \:-\: Z^{-1}\left[\frac{z}{8\left(z \:-\: \frac{1}{4}\right)}\right]}$$

$$\mathrm{\therefore\:y(n) \:=\: \frac{1}{4}\left(\frac{1}{2}\right)^n u(n) \:-\: \frac{1}{8}\left(\frac{1}{4}\right)^n u(n)}$$

This is the natural response (i.e., response due to initial conditions) of the given system.

Solution 2: Forced Response of The System

Consider a unit step sequence is applied to the system. Then, the forced response of the system is the step response. For step response, x(n) = u(n).

Hence, the difference equation of the system becomes −

$$\mathrm{y(n) \:-\: \frac{3}{4}y(n\:-\:1) \:+\: \frac{1}{8}y(n\:-\:2) \:=\: u(n) \:+\: u(n\:-\:1)}$$

As the forced response of the system is due to input alone (i.e., the initial conditions are neglected), we take the Z-transform on both sides −

$$\mathrm{Z\left[y(n) \:-\: \frac{3}{4}y(n\:-\:1) \:+\: \frac{1}{8}y(n\:-\:2)\right] \:=\: Z[u(n) \:+\: u(n\:-\:1)]}$$

$$\mathrm{\Rightarrow\:Y(z) \:-\: \frac{3}{4}z^{-1}Y(z) \:+\: \frac{1}{8}z^{-2}Y(z) \:=\: \frac{z}{z \:-\: 1}\:+\:\frac{1}{z\:-\:1}}$$

$$\mathrm{\Rightarrow\:Y(z)\left(1 \:-\: \frac{3}{4}z^{-1} \:+\: \frac{1}{8}z^{-2}\right) \:=\: \frac{z \:+\: 1}{z \:-\: 1}}$$

$$\mathrm{\therefore\:Y(z) \:=\: \frac{z\:+\:1}{(z\:-\:1)\left(1\:-\:\frac{3}{4}z^{-1}\:+\:\frac{1}{8}z^{-2}\right)}\:=\:\frac{Z^2(z\:+\:1)}{(z\:-\:1)\left(z^2\:-\:\frac{3}{4}z\:+\:\frac{1}{8}\right)}}$$

$$\mathrm{\Rightarrow\: Y(z)\:=\: \frac{z^2(z\:+\:1)}{(z\:-\:1)\left(z\:-\:\frac{1}{2}\right)\left(z\:-\:\frac{1}{4}\right)}}$$

Now, taking partial fractions, we get,

$$\mathrm{\frac{Y(z)}{z}\:=\:\frac{z(z\:+\:1)}{(z\:-\:1)\left(z\:-\:\frac{1}{2}\right)\left(z\:-\:\frac{1}{4}\right)}\:=\:\frac{A}{(z \:-\: 1)}\: + \:\frac{B}{\left(z \:-\: \frac{1}{2}\right)} \:+\: \frac{C}{\left(z \:-\: \frac{1}{4}\right)}}$$

$$\mathrm{\Rightarrow\:\frac{Y(z)}{z} \:=\: \frac{\left(\frac{16}{3}\right)}{(z \:-\: 1)} \:-\: \frac{6}{\left(z\:-\: \frac{1}{2}\right)} \:+\: \frac{\frac{5}{3}}{\left(z \:-\: \frac{1}{4}\right)}}$$

$$\mathrm{\therefore\:\frac{16}{3}\left(\frac{z}{z\:-\:1}\right)\:-\:6\left(\frac{z}{\left(z\:-\:\frac{1}{2}\right)}\right)\:+\:\frac{5}{3}\left(\frac{z}{\left(z\:-\:\frac{1}{4}\right)}\right)}$$

Now, taking the inverse Z-transform on both sides of the above equation, we get,

$$\mathrm{Z^{-1}[Y(z)]\:=\:\frac{16}{3}Z^{-1}\left[\frac{z}{z \:-\: 1}\right] \:-\: 6Z^{-1}\left[\frac{z}{z \:-\: \frac{1}{2}}\right] \:+\: \frac{5}{3}Z^{-1}\left[\frac{z}{z\:- \:\frac{1}{4}}\right]}$$

$$\mathrm{\therefore\:y(n) \:=\: \frac{16}{3}u(n) \:-\: 6\left(\frac{1}{2}\right)^n u(n) \:+\: \frac{5}{3}\left(\frac{1}{4}\right)^n u(n)}$$

This is the forced response (step response) of the given system.

Advertisements