Solution of Difference Equations Using Z-Transform


Z-Transform

The Z-transform is a mathematical tool which is used to convert the difference equations in discrete time domain into the algebraic equations in z-domain. Mathematically, if $\mathrm{\mathit{x\left ( n \right )}}$ is a discrete time function, then its Z-transform is defined as,

$$\mathrm{\mathit{Z\left [ x\left ( n \right ) \right ]\mathrm{\, =\, }X\left ( z \right )\mathrm{\, =\, }\sum_{n\mathrm{\, =\, }-\infty }^{\infty }x\left ( n \right )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, then the response of the system due to input alone is called the forced response of the system.

  • Natural Response  - 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, then 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, then 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{\mathit{y}\mathrm{\left(\mathit{n}\right)}-\frac{3}{4}\mathit{y}\mathrm{\left(\mathit{n-\mathrm{1}}\right)}\:+\:\frac{1}{8}\mathit{y}\mathrm{\left(\mathit{n-\mathrm{2}}\right)}\:\mathrm{=}\:\mathit{x}\mathrm{\left(\mathit{n}\right)}\:\mathrm{+}\:\mathit{x}\mathrm{\left(\mathit{n-\mathrm{1}}\right)}}$$

Also, it is given that $\mathit{y}\mathrm{\left(\mathrm{-1}\right)}\:\mathrm{=}\:0$ and $\mathit{x}\mathrm{\left(\mathrm{-2}\right)}\:\mathrm{=}\:-1$ Then, find −

  • The natural response of the system

  • The forced response of the system

Solution (i) - Natural Response of the System −

As the natural response of the system is the response due to the initial conditions only. For natural response,$\mathit{x}\mathrm{\left(\mathit{n}\right)}$ = 0. Therefore, the difference equation of the given system becomes −

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

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

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

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

$$\mathrm{\because \mathit{y}\mathrm{\left(\mathrm{-1}\right)} \:=\:0\:and\:\mathit{y}\mathrm{\left(\mathrm{-2}\right)} \:=\:-1}$$

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

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

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

By taking the partial fraction, we get,

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

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

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

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

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

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

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

Solution (ii) - 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, $\mathit{x}\mathrm{\left(\mathit{n}\right)}\:\mathrm{=}\:\mathit{u}\mathrm{\left(\mathit{n}\right)}$.

Hence, the difference equation of the system becomes,

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

As the forced response of the system is due to input alone, i.e., the initial conditions are neglected.

Taking the Z-transform on both sides, we get,

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

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

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

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

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

Now, taking partial fraction, we get,

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

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

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

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

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

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

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

Updated on: 31-Jan-2022

15K+ Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements