# 12.7 Difference equations  (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.

Application of nanotechnology in medicine
what is variations in raman spectra for nanomaterials
I only see partial conversation and what's the question here!
what about nanotechnology for water purification
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
what is the stm
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?
what is a peer
What is meant by 'nano scale'?
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
what is Nano technology ?
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
Is there any normative that regulates the use of silver nanoparticles?
what king of growth are you checking .?
Renato
What fields keep nano created devices from performing or assimulating ? Magnetic fields ? Are do they assimilate ?
why we need to study biomolecules, molecular biology in nanotechnology?
?
Kyle
yes I'm doing my masters in nanotechnology, we are being studying all these domains as well..
why?
what school?
Kyle
biomolecules are e building blocks of every organics and inorganic materials.
Joe
anyone know any internet site where one can find nanotechnology papers?
research.net
kanaga
sciencedirect big data base
Ernesto
Introduction about quantum dots in nanotechnology
hi
Loga
what does nano mean?
nano basically means 10^(-9). nanometer is a unit to measure length.
Bharti
how did you get the value of 2000N.What calculations are needed to arrive at it
Privacy Information Security Software Version 1.1a
Good
Got questions? Join the online conversation and get instant answers! By OpenStax By Angela Eckman By Abishek Devaraj By Sean WiffleBoy By Brooke Delaney By Brooke Delaney By OpenStax By Jonathan Long By OpenStax By OpenStax