Difference equations and system representations
Difference equations
Finding transfer function using z-transform
Derivation of state-space from difference equations
Matlab representation
Difference equations
Whereas continuous systems are described by differential equations, discrete systems are described by
difference equations. From the digital control
schematic, we can see that the difference equations show the relationship between the input signal e(k)
and the output signal u(k). Suppose we are interested in the kth output signal u(k). Then, to get this
output signal, we have the computer that computes some function that considers past input signal e(0) to e(k)
and output signals u(0) to u(k-1), which can be expressed as a function of the form
We assume that the function f is linear and depends only on a finite number of signals e's and u's.
Then the
basic structure of the difference equation can be written as
For a while, we will consider the following difference equation (1).
(1)
Finding transfer function using z-transform
Recall that a transfer function for the continuous system we have been considering so far was derived by
first taking
the Laplace transform of differential equations and then solved for Output/Input in terms of s. To derive
the
transfer function in discrete form, the mathematical tool very similar to the Laplace transform called
z-transform
will be used.
The z-transform is defined by
where f(k) is the amplitude of a sample, and the value k = 0, 1, 2, 3, ... refer to the discrete sample
time.
Analogously, this can lead to the relation
By using these relations, we can easily find the discrete transfer function of a given difference
equation.
Suppose we are going to find the transfer function of the system defined by the above difference equation
(1), first,
apply the above relations to each of u(k), e(K), u(k-1), and e(k-1) and you should arrive at
After few steps of algebra, you will have the following transfer function in discrete form (2).
(2)
Note: When finding a transfer function, zero initial conditions must be
assumed.
Derivation of state-space from difference equations
As you see in the continuous Modeling Tutorial page, another way to
represent the system
is to use the state-space form. The basic structure of the discrete state-space is
Matrices F, G, H and J are the discrete version of A, B, C, and D for a continuous case.
If you rewrite the above difference equation (1) to the state-variable form by adding
we can express the system in state-space form
By letting the output be u(k-1), the output equation can be written as
Matlab representation
Now we will show you how to enter equations derived above into Matlab.
1. Transfer Function
Recall for continuous transfer function, the
numerator and the denominator matrices are entered in descending powers of s. The same thing applies to
discrete transfer
functions. The numerator and the denominator matrices will entered in descending powers of z. For example,
we enter the
above transfer function (2) as follows:
numDz=[1 -0.95];
denDZ=[1 -0.75];
2. State-Space
For discrete state-space models, we will do exactly the same as what we did for continuous models. For
example, the above
discrete state-space model will be entered as
F=[1 0;
1 0.75];
G=[0;
-0.95];
H=[0 1];
J=[0];
Note: It is possible to convert from the state-space to transfer function, or vice versa
using Matlab.
To learn about conversion, see Conversion.
User feedback
Use your browser's "Back" button to return to the previous page.
8/13/97 DK