06 02 45 52 PDF
06 02 45 52 PDF
2, JUNE 2006 45
Dept. of Telecommunications, Brno University of Technology, Purkyňova 118, 612 00 Brno, Czech Republic
Abstract. In the paper the relation is given between linear lation of graph transfer from the chosen input node to the
difference equations with constant coefficients those ob- output node [7]. The computer analysis of the realization
tained via the application of forward and backward diffe- structures of discrete systems is performed much the same
rences. Relation is also established between input-output as with the method of nodal voltages in analog circuits and
difference equations and state-space difference equations, systems, and is of fundamental significance in the analysis
which define the state of inner quantities of a discrete sys- of the properties of discrete systems [10, 11]. To make full
tem. In conclusion, the state-space representation of a dis- use of all the knowledge obtained so far by applying diffe-
crete system is given, which is suitable for implementing a rence equations in the representation of discrete systems it
discrete system in the microprocessor and digital signal is necessary to put the different notations of difference
processor. The resultant solution consists of the response equations and their derived functions into a correct mutual
to input signal and the response to non-zero initial condi- relationship.
tions.
discrete systems can be defined using the difference equa- The complete solution of non-homogeneous equation (7)
tions. Consider first a linear stationary discrete system of consists of two parts:
the s-th order whose properties can be represented by a
linear difference equation of the s-th order with constant y[n] = y h [n] + y p [n] . (9)
coefficients [1], [8]:
The general solution yh[n] of homogeneous difference equ-
Bs Δs y[n] + Bs −1 Δs −1 y[n] + Bs − 2 Δs − 2 y[n] + ation will be obtained by solving equation (7) with zero
+ Bs −3 Δs −3 y[n] + L + B1 Δy[n] + B0 y[n] = (5)
right-hand side under non-zero initial conditions:
= As Δ x[n] + As −1 Δ x[n] + As − 2 Δ
s s −1 s−2
x[n] + y[s − 1] , y[s − 2] , L , y[1] , y[0] . (10)
L + A1 Δ x[n] + A0 x[n] . The particular solution of yp[n] depends on the form of the
The constants B0, B1, … , Bs and A0, A1, … , As are the right-hand side of equation (7). The analytical solution is a
difference equation coefficients, the discrete signal x[n] complete solution but it is often very difficult. Analytical
represents the input signal of discrete system, and y[n] is solution for different types of difference equations is des-
the output signal of discrete system. As can be seen, diffe- cribed, for example, in [1]. For practical tasks of digital
rence equation (5) describes the properties of a discrete signal processing there are certain limitations, and for the
system with one input and one output. If the discrete sys- solution the one-sided Z-transform is used [5], [6], [7]:
tem has several inputs and several outputs, difference equ- ∞
ations must be set up for each input and each output. It is F (z ) = Z { f [n] } = ∑ f [n] z − n ⇔ f [n] . (11)
then of advantage to use the matrix notation for a group of n =0
these difference equations. To obtain an analytical solution
of equation (5) we need to know the initial conditions In the solution of difference equation (7) via the Z-trans-
form in the form of (11) the following property of the
Δs −1 y[0], Δs − 2 y[0], Δs −3 y[0], L , Δ y[0], y[0] . transform is exploited:
If we compare equations (15) and (16), we can see the con- The complete solution of non-homogeneous equation in the
nection: form of (20) or (21) will be obtained on the assumption
that we know the initial conditions:
as a a
c0 = , c1 = s −1 , c2 = s −2 , L ,
bs bs bs y[− 1], y[− 2], L , y[− s + 1], y[− s ] . (22)
a1 a
c s −1 = , cs = 0 , As can be seen, we obtain the form of linear difference
bs bs (17) equations with backward differences (4), which is com-
bs −1 b b monly used in digital filter theory.
d1 = , d 2 = s − 2 , d 3 = s −3 , L ,
bs bs bs Conclusion No. 1: If we start from a linear non-ho-
b b mogeneous difference equation with constant coefficients
d s −1 = 1 , d s = 0 . in the form of (5), then after substituting forward and back-
bs bs
ward differences according to (3) or (4) we obtain equiva-
Using different methods of digital filter design (bilinear lent difference equations in the form of (7) and (8) or (20)
transformation, the Remez algorithm, etc.) the coefficients and (21). We can see that we are concerned here with an
ai, bi, i = 0, 1, 2, ... , s (or ci, di) are sought such that the equivalent form if we apply the substitution n = m + s to
requirements, for example, of the tolerance diagram for the equation (20) or (21). It should be noted that this equiva-
width and placement of pass, stop and transition frequency lence only concerns linear difference equations with cons-
bands of digital filter are satisfied [7], [8]. Now we are in- tant coefficients. This equivalence does not hold for non-
terested in what form of difference equation corresponds to linear difference equations or linear difference equations
a procedure that starts directly from transfer function (16). with varying coefficients.
48 Z. SMÉKAL, DIFFERENCE EQUATIONS WITH FORWARD AND BACKWARD DIFFERENCES AND THEIR USAGE ...
3. State-Space Difference Equations and successively substitute this equation in other equations
of (23). After rewriting we obtain the following state-space
and Input-Output Difference difference equations:
Equations
bs −1 ⎛ a ⎞
Non-homogeneous difference equations in the form v1 [n + 1] = v 2 [n] − v1 [n] + ⎜⎜ a s −1 − bs −1 s ⎟⎟ x[n] ,
bs ⎝ bs ⎠
of (5), (7) or (8) only express the relation between input
signal x[n] and output signal y[n] of a discrete system (or b ⎛ a ⎞
between the input and the output signals for a system with v 2 [n + 1] = v3 [n] − s − 2 v1 [n] + ⎜⎜ a s − 2 − bs − 2 s ⎟⎟ x[n] ,
bs ⎝ bs ⎠
several inputs and outputs, in which case a group of diffe-
rence equations is used). The form of input-output diffe- M (25)
rence equation is not very suitable for writing algorithms
b1 ⎛ a ⎞
because it is difficult to determine the value of initial con- v s −1 [n + 1] = v s [n] − v1 [n] + ⎜⎜ a1 − b1 s ⎟⎟ x[n] ,
ditions. As can be seen from conditions (10) and (22), we bs ⎝ bs ⎠
must determine s initial values of output signal y[n], which
b ⎛ a ⎞
are distributed in time and thus influence the rate of pro- v s [n + 1] = − 0 v1 [n] + ⎜⎜ a 0 − b0 s ⎟⎟ x[n] .
cessing the input signal by the discrete system. Of greater bs ⎝ bs ⎠
advantage would be the requirement of initial values defi-
ned for one instant of time, which appears in the solution Writing in matrix notation we obtain:
of difference equation (5). In mathematics, of course, it is v [n + 1] = A v[n ] + B x[n ] , (26)
not customary to do an analysis of difference equations in
the form of (5); in most cases, difference equations in the where the vectors are defined as follows:
form of (7) or (8) are solved. It would be more convenient
v [n + 1] = [v s [n + 1] v s −1 [n + 1] L v 2 [n + 1] v1 [n + 1] ]
T
if we introduced a model of the discrete system with inner
variables. This model is then referred to as state-space
and
model because it will give the values of inner state-space
variables at one instant of time. Let us show a very simple v [n] = [v s [n] v s −1 [n] L v 2 [n] v1 [n] ] .
T
v s −1 [n + 1] = a1 x[n] − b1 y[n] + v s [n] , Sequence h[n] is the impulse response of discrete system,
v s [n + 1] = a 0 x[n] − b0 y[n] . which we obtain using the inverse Z-transform of transfer
function:
50 Z. SMÉKAL, DIFFERENCE EQUATIONS WITH FORWARD AND BACKWARD DIFFERENCES AND THEIR USAGE ...
1
h[n] = ∫ H (z ) z
n−1
dz. (38)
2 πj C
transfer functions Hi(z) in equation (34), which has been etc.), in automotive industry (various types of drive cont-
calculated for the 1st canonic structure of type IIR digital rol), in computer technology (disk drive management), and
filters. Let the input signal be formed by the sum of 4 har- the like. It is therefore important to seek optimum structu-
monic components of 50 Hz, 100 Hz, 150 Hz and 200 Hz res of realizing algorithms for digital signal processing.
frequencies in the form: Linear stationary discrete systems are most frequently
described by means of linear difference equations with
x[n] = 0.245 cos (2π 50 n / f s ) + 0.245 cos (2π 100 n / f s ) +
constant coefficients. Best suited for implementation in
+ 0.245 cos (2 π 150 n / f s ) + 0.245 cos (2 π 200 n / f s ) , fixed-point digital signal processors are state-space diffe-
f s = 8 kHz . (40) rence equations in the so-called canonic form, which are
defined by equations (30). They have a homogeneous
In Fig. 5 we can see the waveform and DFT spectrum, computation structure so that their application is advanta-
which can be displayed directly in the Code Composer geous for both digital signal processor with Harvard archi-
Studio development environment, for filtering the input tecture and digital signal processors with type VLIW archi-
signal (40) in a form when all initial conditions are set to tecture, which use a high degree of parallelism in the pro-
zero. The spectrum only contains the 200 Hz, harmonic cessing.
component because the other components have been filte-
red by the rejection filter. In a similar way, other currently used structures of
discrete systems can be analyzed, such as lattice, linear
prediction, cepstral or continued-fraction-expansion struc-
tures, which are usually also described by systems of dif-
ference equations.
Acknowledgements
The paper was supported by the National Research
Project “Information Society” No 1ET301710509 and with
the support of the research plan MSM 262200022.
References
Fig. 4. State-space variable v11[n] of the first partial section of
[1] ELAYDI S.N. An Introduction to Difference Equations. Second
2nd order, which is realized in the 2nd canonic form.
Edition. New York: Springer, 1999.
For the same filter and the same input signal we will now [2] ZADEH, L.A. DESOER, C.A. Linear System Theory: The State-
change all the initial conditions to a non-zero value (0.1). Space Approach. New York: McGraw-Hill, 1963.
In Fig. 6 we can see that saturation will occur, i.e. the num- [3] SIEBERT, W. McC. Circuits, Signals, and Systems. New York: The
ber range of the representation of numbers in two’s com- MIT Press, McGraw-Hill Company, 1986.
plement will be exceeded, which will result in non- linear [4] KWAKERNAK, H., SIVAN, R., STRUBOS, R.C.W. Modern Sig-
operations being inserted. Due to saturation the spectrum nals and Systems. New Jersey: Prentice Hall, 1991.
will spread and contain several components instead of one [5] JURY, E.I. Theory and Application of the z-Transform Method. New
component. York: Wiley, 1964.
This undesirable situation must be solved in several [6] VÍCH, R. Z-Transform Theory and Applications. Dordrecht: D. Rei-
del Publishing Company. 1987.
possible ways such that saturation does not occur. It is
therefore important that prior to implementing the given [7] MITRA, S.K. Digital Signal Processing: A Computer Based Appro-
ach. Fourth Edition., New York: McGraw-Hill, 2006.
algorithm in a digital signal processor a mathematical ana-
lysis should be performed such that the algorithm is best [8] VÍCH R., SMÉKAL Z. Digital Filters. Prague: Academia, 2000.
adapted to the architecture of the digital signal processor [9] SMÉKAL, Z., SYSEL, P. Digital Signal Processors and their
used. Applications. Prague: Sdělovací technika s.r.o, 2006 (In Czech).
[10] VLACH, J., SINGHAL, K. Computer Methods for Circuit Analysis
and Design. Van Nostrand Reinhold Company, 1983.
[13] PSENICKA, B., BUSTAMANTE BELLO, R., RODRIGUEZ, M. A. [14] DIBLÍK, J., SMÉKAL, Z. About solution of difference equation of
Analysis and synthesis of digital structure by matrix method. In Pro- y(n+2)-1,25y(n+1) + 0,78125y(n) = x(n+2)-x(n). Elektrorevue –
ceedings of the 2nd International Conference on Informatics in Cont- Internet journal (http://www.elektrorevue.cz), ISSN 1213-1539,
rol, Automation and Robotics. Barcelona (Spain), 2005, p.22–29. 2005, no. 1, p.1–14. (In Czech)
Fig. 5. Waveform and spectrum of input and output signals when filtering by rejection filter for zero initial conditions obtained by simulation on
a TMS320C6416 digital signal processor in the Code Composer Studio development environment (Texas Instruments).
Fig. 6. Waveform and spectrum of input and output signals from Fig. 5 after all initial conditions have been set to non-zero.