Upload
others
View
14
Download
0
Embed Size (px)
Citation preview
Signals and SystemsLecture 1: From Continuous Time to Discrete Time
Dr. Guillaume Ducard
Fall 2018
based on materials from: Prof. Dr. Raffaello D’Andrea
Institute for Dynamic Systems and Control
ETH Zurich, Switzerland
1 / 38
Outline
1 IntroductionSystemsSignals
2 Discretizing a CT Signal by Uniform SamplingSampling a CT Signal
3 CT Signal from a DT SignalUsing a Zero-order HoldUsing a First-order Hold
4 Discretization of CT SystemsArchitectureExact Discretization from Solution of SS Diff. EquationCT, No-input State Equations and SolutionExact Discretization Using the No-input Formulation
2 / 38
IntroductionDiscretizing a CT Signal by Uniform Sampling
CT Signal from a DT Signal using the Zero-Order HoldDiscretization of CT Systems
SystemsSignals
Outline
1 IntroductionSystemsSignals
2 Discretizing a CT Signal by Uniform SamplingSampling a CT Signal
3 CT Signal from a DT SignalUsing a Zero-order HoldUsing a First-order Hold
4 Discretization of CT SystemsArchitectureExact Discretization from Solution of SS Diff. EquationCT, No-input State Equations and SolutionExact Discretization Using the No-input Formulation
3 / 38
IntroductionDiscretizing a CT Signal by Uniform Sampling
CT Signal from a DT Signal using the Zero-Order HoldDiscretization of CT Systems
SystemsSignals
What is a system?
A system G operates on the input signal u to produce the outputsignal y, an operation denoted as y = Gu and illustrated as:
Gu
Input
y
Output
Note that, depending on G, the output y could depend on past,current, and future values of the input u.
4 / 38
IntroductionDiscretizing a CT Signal by Uniform Sampling
CT Signal from a DT Signal using the Zero-Order HoldDiscretization of CT Systems
SystemsSignals
Definitions: (Dynamic) Systems
Dynamic Systems
systems that are not static, i.e., their state evolves w.r.t. time, dueto:
input signals,
external perturbations,
or naturally.
For example, a dynamic system is a system which changes:
its trajectory → changes in acceleration, orientation, velocity,position.
its temperature, pressure, volume, mass, etc.
its current, voltage, frequency, etc.
5 / 38
IntroductionDiscretizing a CT Signal by Uniform Sampling
CT Signal from a DT Signal using the Zero-Order HoldDiscretization of CT Systems
SystemsSignals
Outline
1 IntroductionSystemsSignals
2 Discretizing a CT Signal by Uniform SamplingSampling a CT Signal
3 CT Signal from a DT SignalUsing a Zero-order HoldUsing a First-order Hold
4 Discretization of CT SystemsArchitectureExact Discretization from Solution of SS Diff. EquationCT, No-input State Equations and SolutionExact Discretization Using the No-input Formulation
6 / 38
IntroductionDiscretizing a CT Signal by Uniform Sampling
CT Signal from a DT Signal using the Zero-Order HoldDiscretization of CT Systems
SystemsSignals
What is a signal?
A signal is a function of time that represents a physical quantitysuch as a force, position, or voltage.
Continuous-time (CT) signals
x(t) : t is continuous, t ∈ R (the set of real numbers)
x(t) takes on continuous values analog signal
t
x(t)
7 / 38
IntroductionDiscretizing a CT Signal by Uniform Sampling
CT Signal from a DT Signal using the Zero-Order HoldDiscretization of CT Systems
SystemsSignals
Discrete-time (DT) signals
x[n] : n is discrete, an integer,
n ∈ Z (the set of integer numbers, Z = {. . . ,−1, 0, 1, . . .})
x[n] can take continuous or discrete values
n
x[n]
−1 0 1 2 3 4
1
2
0
1 1
2
8 / 38
IntroductionDiscretizing a CT Signal by Uniform Sampling
CT Signal from a DT Signal using the Zero-Order HoldDiscretization of CT Systems
SystemsSignals
In this class, we focus on DT signals:
CT signals were treated extensively in Control Systems 1 & 2.
In DT the math is simpler, which allows us to focus onconcepts.
1 Integrals are replaced by sums,2 differentiation is replaced by finite differences,3 and the Dirac delta function is replaced by the unit impulse.
Algorithms are implemented in discrete time on computers.
9 / 38
IntroductionDiscretizing a CT Signal by Uniform Sampling
CT Signal from a DT Signal using the Zero-Order HoldDiscretization of CT Systems
SystemsSignals
We focus on discrete-time signals with the signal x[n] taking oncontinuous values:
Assuming continuous values simplifies the math.
This is a good approximation: On modern computers thedouble data type stores numbers using 8 bytes (= 64 bits)and hence allows for 264 ≈ 1020 different values.
x[n] can be a vector, however we mainly deal with scalarsignals in this class.
x[n] can be a complex number:
x[n] = x1[n] + jx2[n], x1[n], x2[n] ∈ R, j2 = −1
10 / 38
IntroductionDiscretizing a CT Signal by Uniform Sampling
CT Signal from a DT Signal using the Zero-Order HoldDiscretization of CT Systems
SystemsSignals
A word on notation
A sequence is a DT signal. The terms are usedinterchangeably.
x denotes a signal. It is a function of time.
x[n] indicates the value of x at the discrete time n.
x(t) indicates the value of x at the continuous time t.
{x[n]} refers to the entire sequence. It is the same as x forDT signals.
Motivated by the above, {x(t)} refers to the entire CT signal.It is the same as x for CT signals.
11 / 38
IntroductionDiscretizing a CT Signal by Uniform Sampling
CT Signal from a DT Signal using the Zero-Order HoldDiscretization of CT Systems
SystemsSignals
Three signal representations of DT signals
Graph:
n
x[n]
−2 −1 0 1 2 3
0 0
1 12 1
418
Rule:
x[n] :=
{
(12)n n ≥ 0
0 n < 0
Sequence:
{x[n]} = {. . . , 0, 1↑,1
2,1
4, . . . },
where the arrow indicates the value at n = 0. If an arrow is absent, thefirst value of the sequence is assumed to occur at time n = 0.
12 / 38
IntroductionDiscretizing a CT Signal by Uniform Sampling
CT Signal from a DT Signal using the Zero-Order HoldDiscretization of CT Systems
Sampling a CT Signal
Outline
1 IntroductionSystemsSignals
2 Discretizing a CT Signal by Uniform SamplingSampling a CT Signal
3 CT Signal from a DT SignalUsing a Zero-order HoldUsing a First-order Hold
4 Discretization of CT SystemsArchitectureExact Discretization from Solution of SS Diff. EquationCT, No-input State Equations and SolutionExact Discretization Using the No-input Formulation
13 / 38
IntroductionDiscretizing a CT Signal by Uniform Sampling
CT Signal from a DT Signal using the Zero-Order HoldDiscretization of CT Systems
Sampling a CT Signal
Sampling a CT signal {x(t)} at uniformly-spaced points in timeresults in the DT sequence {x[n]}, where
x[n] = x(nTs)
for all integers n, and where:
Ts is the sampling period.
The variable fs =1Ts
is the sampling frequency.
n
x[n]
1 2 3 4
14 / 38
IntroductionDiscretizing a CT Signal by Uniform Sampling
CT Signal from a DT Signal using the Zero-Order HoldDiscretization of CT Systems
Using a Zero-order HoldUsing a First-order Hold
Outline
1 IntroductionSystemsSignals
2 Discretizing a CT Signal by Uniform SamplingSampling a CT Signal
3 CT Signal from a DT SignalUsing a Zero-order HoldUsing a First-order Hold
4 Discretization of CT SystemsArchitectureExact Discretization from Solution of SS Diff. EquationCT, No-input State Equations and SolutionExact Discretization Using the No-input Formulation
15 / 38
IntroductionDiscretizing a CT Signal by Uniform Sampling
CT Signal from a DT Signal using the Zero-Order HoldDiscretization of CT Systems
Using a Zero-order HoldUsing a First-order Hold
Zero-order Hold
A CT signal {x(t)} can be obtained from a DT signal {x[n]} by“holding” the value of the DT signal constant for one samplingperiod Ts, such that:
x(t) = x[n] nTs ≤ t < (n+ 1)Ts.
This is known as the zero-order hold.
t
x(t)
Ts 2Ts 3Ts 4Ts
16 / 38
IntroductionDiscretizing a CT Signal by Uniform Sampling
CT Signal from a DT Signal using the Zero-Order HoldDiscretization of CT Systems
Using a Zero-order HoldUsing a First-order Hold
Outline
1 IntroductionSystemsSignals
2 Discretizing a CT Signal by Uniform SamplingSampling a CT Signal
3 CT Signal from a DT SignalUsing a Zero-order HoldUsing a First-order Hold
4 Discretization of CT SystemsArchitectureExact Discretization from Solution of SS Diff. EquationCT, No-input State Equations and SolutionExact Discretization Using the No-input Formulation
17 / 38
IntroductionDiscretizing a CT Signal by Uniform Sampling
CT Signal from a DT Signal using the Zero-Order HoldDiscretization of CT Systems
Using a Zero-order HoldUsing a First-order Hold
First-order Hold
Alternative methods exist to obtain a CT signal from a DT signal,such as the first-order hold:
t
x(t)
Ts 2Ts 3Ts 4Ts
However, in this class we will exclusively work with zero-order hold,which we will simply call hold.
18 / 38
IntroductionDiscretizing a CT Signal by Uniform Sampling
CT Signal from a DT Signal using the Zero-Order HoldDiscretization of CT Systems
ArchitectureExact Discretization from Solution of SS Diff. EquationCT, No-input State Equations and SolutionExact Discretization Using the No-input Formulation
Outline
1 IntroductionSystemsSignals
2 Discretizing a CT Signal by Uniform SamplingSampling a CT Signal
3 CT Signal from a DT SignalUsing a Zero-order HoldUsing a First-order Hold
4 Discretization of CT SystemsArchitectureExact Discretization from Solution of SS Diff. EquationCT, No-input State Equations and SolutionExact Discretization Using the No-input Formulation
19 / 38
IntroductionDiscretizing a CT Signal by Uniform Sampling
CT Signal from a DT Signal using the Zero-Order HoldDiscretization of CT Systems
ArchitectureExact Discretization from Solution of SS Diff. EquationCT, No-input State Equations and SolutionExact Discretization Using the No-input Formulation
Interface between CT and DT systems
To interact with a CT (eg. “real-world”) system Gc from a DTenvironment (eg. a computer), we need to:
convert a DT signal into a CT signal, (ex: Digital to AnalogConverters (DAC)
and vice versa. (ex: Analog to Digital Converters (ADC))
This can be captured formally with the hold and sample operatorsas follows:
H Gc S{u[n]} {u(t)} {y(t)} {y[n]}
By defining the DT system Gd := SGcH, the previous figure can bereplaced by:
Gd
{u[n]} {y[n]}
20 / 38
IntroductionDiscretizing a CT Signal by Uniform Sampling
CT Signal from a DT Signal using the Zero-Order HoldDiscretization of CT Systems
ArchitectureExact Discretization from Solution of SS Diff. EquationCT, No-input State Equations and SolutionExact Discretization Using the No-input Formulation
In the following, we consider the case where Gc is a CT lineartime-invariant (LTI) system with a state-space description
q(t) = Acq(t) +Bcu(t)
y(t) = Ccq(t) +Dcu(t). (1)
The solution to the differential equation is
q(t) = eActq(0) +
∫
t
0eAc(t−τ)Bcu(τ)dτ .
Demonstration recalled in class on blackboard.
21 / 38
IntroductionDiscretizing a CT Signal by Uniform Sampling
CT Signal from a DT Signal using the Zero-Order HoldDiscretization of CT Systems
ArchitectureExact Discretization from Solution of SS Diff. EquationCT, No-input State Equations and SolutionExact Discretization Using the No-input Formulation
The goal is to find
a description for the DT LTI system
Gd = SGcH .
The discrete-time equivalent of Equation 1 is of the form:
q[n+ 1] = Adq[n] +Bdu[n]
y[n] = Cdq[n] +Ddu[n]
which is the description of the DT system Gd = SGcH that we arelooking for.
22 / 38
IntroductionDiscretizing a CT Signal by Uniform Sampling
CT Signal from a DT Signal using the Zero-Order HoldDiscretization of CT Systems
ArchitectureExact Discretization from Solution of SS Diff. EquationCT, No-input State Equations and SolutionExact Discretization Using the No-input Formulation
Outline
1 IntroductionSystemsSignals
2 Discretizing a CT Signal by Uniform SamplingSampling a CT Signal
3 CT Signal from a DT SignalUsing a Zero-order HoldUsing a First-order Hold
4 Discretization of CT SystemsArchitectureExact Discretization from Solution of SS Diff. EquationCT, No-input State Equations and SolutionExact Discretization Using the No-input Formulation
23 / 38
IntroductionDiscretizing a CT Signal by Uniform Sampling
CT Signal from a DT Signal using the Zero-Order HoldDiscretization of CT Systems
ArchitectureExact Discretization from Solution of SS Diff. EquationCT, No-input State Equations and SolutionExact Discretization Using the No-input Formulation
The discrete-time equivalent of Equation 1 is of the form
q[n+ 1] = Adq[n] +Bdu[n]
y[n] = Cdq[n] +Ddu[n]
which is the description of the DT system Gd = SGcH looked for. It can beshown, starting from the solution of the continuous state-space equation
q(t) = eActq(0) +
∫t
0
eAc(t−τ)
Bcu(τ )dτ.
that the corresponding discrete matrices are obtained as:
Ad = eAcTs and Bd =(∫
Ts
0eAcτdτ
)
Bc
with the sampling period Ts.
Demonstration is done on the board during the class. Remarks:
This is the exact solution to the differential equation, there are nodiscretization errors.
While it is exact, information is still lost by the discretization: theinter-sample behavior.
24 / 38
IntroductionDiscretizing a CT Signal by Uniform Sampling
CT Signal from a DT Signal using the Zero-Order HoldDiscretization of CT Systems
ArchitectureExact Discretization from Solution of SS Diff. EquationCT, No-input State Equations and SolutionExact Discretization Using the No-input Formulation
Outline
1 IntroductionSystemsSignals
2 Discretizing a CT Signal by Uniform SamplingSampling a CT Signal
3 CT Signal from a DT SignalUsing a Zero-order HoldUsing a First-order Hold
4 Discretization of CT SystemsArchitectureExact Discretization from Solution of SS Diff. EquationCT, No-input State Equations and SolutionExact Discretization Using the No-input Formulation
25 / 38
IntroductionDiscretizing a CT Signal by Uniform Sampling
CT Signal from a DT Signal using the Zero-Order HoldDiscretization of CT Systems
ArchitectureExact Discretization from Solution of SS Diff. EquationCT, No-input State Equations and SolutionExact Discretization Using the No-input Formulation
In this section, we will show how the discrete matrices Ad and Bd can beobtained through a slightly different approach. It consists of :
1 simplifying the state equations in (1), by taking into account that theinput is constant during a sampling period (zero-order hold assumption).
2 rewriting the system as a no-input (or homogeneous) system of the type
r(t) = Mr(t). (2)
Such a system has the straightforward solution
r(t) = eMt
r(0), (3)
where eMt is the matrix exponential:
eMt := I +Mt+
(Mt)2
2+ · · ·+
(Mt)k
k!+ · · · =
∞∑
k=0
(Mt)k
k!.
Remarks:
When M is a scalar (matrix of dimension 1× 1), we recover the standarddefinition of the exponential.
It can be shown that the power series defining the matrix exponentialconverges for all real (or complex) square matrices.
26 / 38
IntroductionDiscretizing a CT Signal by Uniform Sampling
CT Signal from a DT Signal using the Zero-Order HoldDiscretization of CT Systems
ArchitectureExact Discretization from Solution of SS Diff. EquationCT, No-input State Equations and SolutionExact Discretization Using the No-input Formulation
Proof that the solution (3) satisfies the differential equation (2)
Let r(t) = eMtr(0). It follows that r(t) = deMt
dtr(0).
For convergent power series, the derivative can be evaluated as:
deMt
dt=
d
dt
∞∑
k=0
(Mt)k
k!
=∞∑
k=0
kMktk−1
k!=
∞∑
k=1
kMktk−1
k!
=
∞∑
k=1
Mktk−1
(k − 1)!= M
∞∑
k=1
Mk−1tk−1
(k − 1)!
= M
∞∑
l=0
M ltl
l!with the substitution l := k − 1
= MeMt
.
∴ r(t) = MeMt
r(0) = Mr(t).
27 / 38
IntroductionDiscretizing a CT Signal by Uniform Sampling
CT Signal from a DT Signal using the Zero-Order HoldDiscretization of CT Systems
ArchitectureExact Discretization from Solution of SS Diff. EquationCT, No-input State Equations and SolutionExact Discretization Using the No-input Formulation
Example : Double integrator with zero input
”Standard solution approach”Consider the system described by the differential equation
y(t) = 0
with initial conditions y(0) = v0, y(0) = y0.
We can immediately write the solution:
y(t)= v0,
y(t) = y0 + v0t.
28 / 38
IntroductionDiscretizing a CT Signal by Uniform Sampling
CT Signal from a DT Signal using the Zero-Order HoldDiscretization of CT Systems
ArchitectureExact Discretization from Solution of SS Diff. EquationCT, No-input State Equations and SolutionExact Discretization Using the No-input Formulation
Example : Double integrator with zero input
The solution can also be derived using the matrix exponential: let
r(t) =
[r1(t)r2(t)
]
:=
[y(t)y(t)
]
r(0) =
[y0v0
]
.
Then[r1(t)r2(t)
]
=
[r2(t)0
]
=
[0 10 0
]
︸ ︷︷ ︸
= M
[r1(t)r2(t)
]
.
Note that the matrix M is nilpotent because M2 = 0, and therefore
eMt = I +Mt
[r1(t)r2(t)
]
=
[1 t
0 1
] [y0v0
]
.
which is identical solution as the one found before, i.e.
y(t) = v0, y(t) = y0 + v0t. (4)29 / 38
IntroductionDiscretizing a CT Signal by Uniform Sampling
CT Signal from a DT Signal using the Zero-Order HoldDiscretization of CT Systems
ArchitectureExact Discretization from Solution of SS Diff. EquationCT, No-input State Equations and SolutionExact Discretization Using the No-input Formulation
Relation to the Euler forward method
Matrix exponential approximation
When t is very small, the matrix exponential can be approximated by
eMt
≈ I +Mt
and therefore r(t) = eMtr(0) ≈ (I +Mt)r(0) ≈ r(0) + tMr(0).
Euler forward method
The Euler forward method approximates a function’s derivative as
r(0) ≈r(t)− r(0)
t.
For small t, and with r(t) = Mr(t) we have r(t)−r(0)t
≈ Mr(0), which yieldsr(t) ≈ r(0) + tMr(0).
⇒ The Euler forward method gives the same result as a first-orderapproximation to the matrix exponential.
30 / 38
IntroductionDiscretizing a CT Signal by Uniform Sampling
CT Signal from a DT Signal using the Zero-Order HoldDiscretization of CT Systems
ArchitectureExact Discretization from Solution of SS Diff. EquationCT, No-input State Equations and SolutionExact Discretization Using the No-input Formulation
Outline
1 IntroductionSystemsSignals
2 Discretizing a CT Signal by Uniform SamplingSampling a CT Signal
3 CT Signal from a DT SignalUsing a Zero-order HoldUsing a First-order Hold
4 Discretization of CT SystemsArchitectureExact Discretization from Solution of SS Diff. EquationCT, No-input State Equations and SolutionExact Discretization Using the No-input Formulation
31 / 38
IntroductionDiscretizing a CT Signal by Uniform Sampling
CT Signal from a DT Signal using the Zero-Order HoldDiscretization of CT Systems
ArchitectureExact Discretization from Solution of SS Diff. EquationCT, No-input State Equations and SolutionExact Discretization Using the No-input Formulation
The original problem was, for the first time step
q(t) = Acq(t) +Bcu(t), q(0) = q[0],
u(t) = u[0] 0 ≤ t < Ts
where
1 u is constant over the sampling interval due to the zero-order hold device
2 and we set the initial state q(0) to its discrete-time counter-part q[0].
We can rewrite these equations as the zero-input system (2)
[q(t)u(t)
]
=
[Ac Bc
0 0
]
︸ ︷︷ ︸
=: M
[q(t)u(t)
]
by including the input in the state of this adapted system.
32 / 38
IntroductionDiscretizing a CT Signal by Uniform Sampling
CT Signal from a DT Signal using the Zero-Order HoldDiscretization of CT Systems
ArchitectureExact Discretization from Solution of SS Diff. EquationCT, No-input State Equations and SolutionExact Discretization Using the No-input Formulation
Therefore, the solution at time T−
s , just before the sampling time, is
[q(T−
s )u(T−
s )
]
= eMTs
[q(0)u(0)
]
with
F = eMTs =
[F11 F12
F21 F22
]
.
It is easy to show that
F21 = 0 and F22 = I,
since
Mk =
[∗ ∗
0 0
]
for any integer k ≥ 1.
This result is expected, since u is constant over the sampling interval and thusu(T−
s ) = u(0).
33 / 38
IntroductionDiscretizing a CT Signal by Uniform Sampling
CT Signal from a DT Signal using the Zero-Order HoldDiscretization of CT Systems
ArchitectureExact Discretization from Solution of SS Diff. EquationCT, No-input State Equations and SolutionExact Discretization Using the No-input Formulation
Ad= F11, Bd = F12
Cd= Cc, Dd = Dc.
Then
q[1] = Adq[0] +Bdu[0]
y[0] = Cdq[0] +Ddu[0].
We can do this for any time period, since the CT system is time invariant, andthus obtain:
q[n+ 1] = Adq[n] +Bdu[n]
y[n] = Cdq[n] +Ddu[n]
which is the description of the DT system Gd = SGcH that we were looking for.
This is the exact solution to the differential equation, there are nodiscretization errors.
While it is exact, information is still lost by the discretization: Theinter-sample behavior.
34 / 38
IntroductionDiscretizing a CT Signal by Uniform Sampling
CT Signal from a DT Signal using the Zero-Order HoldDiscretization of CT Systems
ArchitectureExact Discretization from Solution of SS Diff. EquationCT, No-input State Equations and SolutionExact Discretization Using the No-input Formulation
Mass-spring-damper system
Consider a mass-spring-damper system with the differential equation
p(t) + p(t) + p(t) = f(t)
and compare:
1 the Euler discretization,
2 to the exact discretization,
with sampling times of 0.1s and 0.5s.
35 / 38
IntroductionDiscretizing a CT Signal by Uniform Sampling
CT Signal from a DT Signal using the Zero-Order HoldDiscretization of CT Systems
ArchitectureExact Discretization from Solution of SS Diff. EquationCT, No-input State Equations and SolutionExact Discretization Using the No-input Formulation
The input to the continuous and discretized models is a pulse with a width of0.5 seconds, identical to the longest sampling time used.
0 2 4 6 8 10
0
1
2
Time (s)
Input(N
)continuous
Ts = 0.1s
Ts = 0.5s
36 / 38
IntroductionDiscretizing a CT Signal by Uniform Sampling
CT Signal from a DT Signal using the Zero-Order HoldDiscretization of CT Systems
ArchitectureExact Discretization from Solution of SS Diff. EquationCT, No-input State Equations and SolutionExact Discretization Using the No-input Formulation
0 2 4 6 8 10
0
0.5
Time (s)
Position(m
)Euler Discretization
continuous
Ts = 0.1s
Ts = 0.5s
When discretizing using the Euler discretization, the output strongly dependson the discretization time, and differs from the continuous-time output even forsmall sampling times (remember that the Euler discretization is identical to afirst-order approximation of the matrix exponential – the errors seen here stemfrom this approximation)
37 / 38
IntroductionDiscretizing a CT Signal by Uniform Sampling
CT Signal from a DT Signal using the Zero-Order HoldDiscretization of CT Systems
ArchitectureExact Discretization from Solution of SS Diff. EquationCT, No-input State Equations and SolutionExact Discretization Using the No-input Formulation
The exact discretization has no discretization errors. The discrete-time outputcoincides with the continuous-time output at the sampling times:
0 2 4 6 8 10
0
0.2
0.4
0.6
Time (s)
Position(m
)
Exact Discretization
continuous
Ts = 0.1s
Ts = 0.5s
38 / 38