# Difference equation  (Page 2/2)

 Page 2 / 2

## Finding difference equation

Below is a basic example showing the opposite of the steps above: given a transfer function one can easily calculate thesystems difference equation.

$H(z)=\frac{(z+1)^{2}}{(z-\frac{1}{2})(z+\frac{3}{4})}$
Given this transfer function of a time-domain filter, we want to find the difference equation. To begin with, expand bothpolynomials and divide them by the highest order $z$ .
$H(z)=\frac{(z+1)(z+1)}{(z-\frac{1}{2})(z+\frac{3}{4})}=\frac{z^{2}+2z+1}{z^{2}+2z+1-\frac{3}{8}}=\frac{1+2z^{-1}+z^{-2}}{1+\frac{1}{4}z^{-1}-\frac{3}{8}z^{-2}}$
From this transfer function, the coefficients of the two polynomials will be our ${a}_{k}()$ and ${b}_{k}()$ values found in the general difference equation formula, [link] . Using these coefficients and the above form of the transferfunction, we can easily write the difference equation:
$x(n)+2x(n-1)+x(n-2)=y(n)+\frac{1}{4}y(n-1)-\frac{3}{8}y(n-2)$
In our final step, we can rewrite the difference equation in its more common form showing the recursive nature of the system.
$y(n)=x(n)+2x(n-1)+x(n-2)+\frac{-1}{4}y(n-1)+\frac{3}{8}y(n-2)$

## Solving a lccde

In order for a linear constant-coefficient difference equation to be useful in analyzing a LTI system, we must be able tofind the systems output based upon a known input, $x(n)$ , and a set of initial conditions. Two common methods exist for solving a LCCDE: the direct method and the indirect method , the later being based on the z-transform. Below we will briefly discussthe formulas for solving a LCCDE using each of these methods.

## Direct method

The final solution to the output based on the direct method is the sum of two parts, expressed in the followingequation:

$y(n)={y}_{h}(n)+{y}_{p}(n)$
The first part, ${y}_{h}(n)$ , is referred to as the homogeneous solution and the second part, ${y}_{h}(n)$ , is referred to as particular solution . The following method is very similar to that used to solve many differential equations, so if youhave taken a differential calculus course or used differential equations before then this should seem veryfamiliar.

## Homogeneous solution

We begin by assuming that the input is zero, $x(n)=0$ .Now we simply need to solve the homogeneous difference equation:

$\sum_{k=0}^{N} {a}_{k}()y(n-k)=0$
In order to solve this, we will make the assumption that the solution is in the form of an exponential. We willuse lambda, $\lambda$ , to represent our exponential terms. We now have to solve thefollowing equation:
$\sum_{k=0}^{N} {a}_{k}()\lambda ^{(n-k)}=0$
We can expand this equation out and factor out all of thelambda terms. This will give us a large polynomial in parenthesis, which is referred to as the characteristic polynomial . The roots of this polynomial will be the key to solving the homogeneousequation. If there are all distinct roots, then the general solution to the equation will be as follows:
${y}_{h}(n)={C}_{1}(){\lambda }_{1}()^{n}+{C}_{2}(){\lambda }_{2}()^{n}+\dots +{C}_{N}(){\lambda }_{N}()^{n}$
However, if the characteristic equation contains multiple roots then the above general solution will be slightlydifferent. Below we have the modified version for an equation where ${\lambda }_{1}$ has $K$ multiple roots:
${y}_{h}(n)={C}_{1}(){\lambda }_{1}()^{n}+{C}_{1}()n{\lambda }_{1}()^{n}+{C}_{1}()n^{2}{\lambda }_{1}()^{n}+\dots +{C}_{1}()n^{(K-1)}{\lambda }_{1}()^{n}+{C}_{2}(){\lambda }_{2}()^{n}+\dots +{C}_{N}(){\lambda }_{N}()^{n}$

## Particular solution

The particular solution, ${y}_{p}(n)$ , will be any solution that will solve the general difference equation:

$\sum_{k=0}^{N} {a}_{k}(){y}_{p}(n-k)=\sum_{k=0}^{M} {b}_{k}()x(n-k)$
In order to solve, our guess for the solution to ${y}_{p}(n)$ will take on the form of the input, $x(n)$ . After guessing at a solution to the above equation involving the particular solution, one onlyneeds to plug the solution into the difference equation and solve it out.

## Indirect method

The indirect method utilizes the relationship between the difference equation and z-transform, discussed earlier , to find a solution. The basic idea is to convert the differenceequation into a z-transform, as described above , to get the resulting output, $Y(z)$ . Then by inverse transforming this and using partial-fractionexpansion, we can arrive at the solution.

$Z\left\{y,\left(n+1\right),-,y,\left(n\right)\right\}=zY\left(z\right)-y\left(0\right)$

This can be interatively extended to an arbitrary order derivative as in Equation [link] .

$Z\left\{-,\sum _{m=0}^{N-1},y,\left(n-m\right)\right\}={z}^{n}Y\left(z\right)-\sum _{m=0}^{N-1}{z}^{n-m-1}{y}^{\left(m\right)}\left(0\right)$

Now, the Laplace transform of each side of the differential equation can be taken

$Z\left\{\sum _{k=0}^{N},{a}_{k},\left[y,\left(n-m+1\right),-,\sum _{m=0}^{N-1},y,\left(n-m\right),y,\left(n\right)\right],=,Z,\left\{x,\left(,n,\right)\right\}\right\}$

which by linearity results in

$\sum _{k=0}^{N}{a}_{k}Z\left\{y,\left(n-m+1\right),-,\sum _{m=0}^{N-1},y,\left(n-m\right),y,\left(n\right)\right\}=Z\left\{x,\left(,n,\right)\right\}$

and by differentiation properties in

$\sum _{k=0}^{N}{a}_{k}\left({z}^{k},Z,\left\{y,\left(,n,\right)\right\},-,\sum _{m=0}^{N-1},{z}^{k-m-1},{y}^{\left(m\right)},\left(0\right)\right)=Z\left\{x,\left(,n,\right)\right\}.$

Rearranging terms to isolate the Laplace transform of the output,

$Z\left\{y,\left(,n,\right)\right\}=\frac{Z\left\{x,\left(,n,\right)\right\}+{\sum }_{k=0}^{N}{\sum }_{m=0}^{k-1}{a}_{k}{z}^{k-m-1}{y}^{\left(m\right)}\left(0\right)}{{\sum }_{k=0}^{N}{a}_{k}{z}^{k}}.$

Thus, it is found that

$Y\left(z\right)=\frac{X\left(z\right)+{\sum }_{k=0}^{N}{\sum }_{m=0}^{k-1}{a}_{k}{z}^{k-m-1}{y}^{\left(m\right)}\left(0\right)}{{\sum }_{k=0}^{N}{a}_{k}{z}^{k}}.$

In order to find the output, it only remains to find the Laplace transform $X\left(z\right)$ of the input, substitute the initial conditions, and compute the inverse Z-transform of the result. Partial fraction expansions are often required for this last step. This may sound daunting while looking at [link] , but it is often easy in practice, especially for low order difference equations. [link] can also be used to determine the transfer function and frequency response.

As an example, consider the difference equation

$y\left[n-2\right]+4y\left[n-1\right]+3y\left[n\right]=cos\left(n\right)$

with the initial conditions ${y}^{\text{'}}\left(0\right)=1$ and $y\left(0\right)=0$ Using the method described above, the Z transform of the solution $y\left[n\right]$ is given by

$Y\left[z\right]=\frac{z}{\left[{z}^{2}+1\right]\left[z+1\right]\left[z+3\right]}+\frac{1}{\left[z+1\right]\left[z+3\right]}.$

Performing a partial fraction decomposition, this also equals

$Y\left[z\right]=.25\frac{1}{z+1}-.35\frac{1}{z+3}+.1\frac{z}{{z}^{2}+1}+.2\frac{1}{{z}^{2}+1}.$

Computing the inverse Laplace transform,

$y\left(n\right)=\left(.25{z}^{-n}-.35{z}^{-3n}+.1cos\left(n\right)+.2sin\left(n\right)\right)u\left(n\right).$

One can check that this satisfies that this satisfies both the differential equation and the initial conditions.

#### Questions & Answers

how can chip be made from sand
Eke Reply
is this allso about nanoscale material
Almas
are nano particles real
Missy Reply
yeah
Joseph
Hello, if I study Physics teacher in bachelor, can I study Nanotechnology in master?
Lale Reply
no can't
Lohitha
where is the latest information on a no technology how can I find it
William
currently
William
where we get a research paper on Nano chemistry....?
Maira Reply
nanopartical of organic/inorganic / physical chemistry , pdf / thesis / review
Ali
what are the products of Nano chemistry?
Maira Reply
There are lots of products of nano chemistry... Like nano coatings.....carbon fiber.. And lots of others..
learn
Even nanotechnology is pretty much all about chemistry... Its the chemistry on quantum or atomic level
learn
Google
da
no nanotechnology is also a part of physics and maths it requires angle formulas and some pressure regarding concepts
Bhagvanji
hey
Giriraj
Preparation and Applications of Nanomaterial for Drug Delivery
Hafiz Reply
revolt
da
Application of nanotechnology in medicine
has a lot of application modern world
Kamaluddeen
yes
narayan
what is variations in raman spectra for nanomaterials
Jyoti Reply
ya I also want to know the raman spectra
Bhagvanji
I only see partial conversation and what's the question here!
Crow Reply
what about nanotechnology for water purification
RAW Reply
please someone correct me if I'm wrong but I think one can use nanoparticles, specially silver nanoparticles for water treatment.
Damian
yes that's correct
Professor
I think
Professor
Nasa has use it in the 60's, copper as water purification in the moon travel.
Alexandre
nanocopper obvius
Alexandre
what is the stm
Brian Reply
is there industrial application of fullrenes. What is the method to prepare fullrene on large scale.?
Rafiq
industrial application...? mmm I think on the medical side as drug carrier, but you should go deeper on your research, I may be wrong
Damian
How we are making nano material?
LITNING Reply
what is a peer
LITNING Reply
What is meant by 'nano scale'?
LITNING Reply
What is STMs full form?
LITNING
scanning tunneling microscope
Sahil
how nano science is used for hydrophobicity
Santosh
Do u think that Graphene and Fullrene fiber can be used to make Air Plane body structure the lightest and strongest. Rafiq
Rafiq
what is differents between GO and RGO?
Mahi
what is simplest way to understand the applications of nano robots used to detect the cancer affected cell of human body.? How this robot is carried to required site of body cell.? what will be the carrier material and how can be detected that correct delivery of drug is done Rafiq
Rafiq
if virus is killing to make ARTIFICIAL DNA OF GRAPHENE FOR KILLED THE VIRUS .THIS IS OUR ASSUMPTION
Anam
analytical skills graphene is prepared to kill any type viruses .
Anam
Any one who tell me about Preparation and application of Nanomaterial for drug Delivery
Hafiz
what is Nano technology ?
Bob Reply
write examples of Nano molecule?
Bob
The nanotechnology is as new science, to scale nanometric
brayan
nanotechnology is the study, desing, synthesis, manipulation and application of materials and functional systems through control of matter at nanoscale
Damian
Got questions? Join the online conversation and get instant answers!
Jobilize.com Reply

### Read also:

#### Get Jobilize Job Search Mobile App in your pocket Now!

Source:  OpenStax, Fundamentals of signal processing. OpenStax CNX. Nov 26, 2012 Download for free at http://cnx.org/content/col10360/1.4
Google Play and the Google Play logo are trademarks of Google Inc.

Notification Switch

Would you like to follow the 'Fundamentals of signal processing' conversation and receive update notifications?

 By Mldelatte By OpenStax By Abishek Devaraj By By OpenStax By Brooke Delaney By Kevin Moquin By Marion Cabalfin By Stephen Voron By OpenStax