% I/O Behavior % ๐ค Sรฉbastien Boisgรฉrault
-
๐ Documents (GitHub)
-
ยฉ๏ธ License CC BY 4.0
๐ | Code | ๐ | Worked Example |
๐ | Graph | ๐งฉ | Exercise |
๐ท๏ธ | Definition | ๐ป | Numerical Method |
๐ | Theorem | ๐งฎ | Analytical Method |
๐ | Remark | ๐ง | Theory |
โน๏ธ | Information | ๐๏ธ | Hint |
Warning | ๐ | Solution |
from numpy import *
from numpy.linalg import *
from scipy.linalg import *
from matplotlib.pyplot import *
from mpl_toolkits.mplot3d import *
from scipy.integrate import solve_ivp
::: hidden :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
# Python 3.x Standard Library
import gc
import os
# Third-Party Packages
import numpy as np; np.seterr(all="ignore")
import numpy.linalg as la
import scipy.misc
import matplotlib as mpl; mpl.use("Agg")
import matplotlib.pyplot as pp
import matplotlib.axes as ax
import matplotlib.patches as pa
#
# Matplotlib Configuration & Helper Functions
# --------------------------------------------------------------------------
# TODO: also reconsider line width and markersize stuff "for the web
# settings".
fontsize = 10
width = 345 / 72.27
height = width / (16/9)
rc = {
"text.usetex": True,
"pgf.preamble": r"\usepackage{amsmath,amsfonts,amssymb}",
#"font.family": "serif",
"font.serif": [],
#"font.sans-serif": [],
"legend.fontsize": fontsize,
"axes.titlesize": fontsize,
"axes.labelsize": fontsize,
"xtick.labelsize": fontsize,
"ytick.labelsize": fontsize,
"figure.max_open_warning": 100,
#"savefig.dpi": 300,
#"figure.dpi": 300,
"figure.figsize": [width, height],
"lines.linewidth": 1.0,
}
mpl.rcParams.update(rc)
# Web target: 160 / 9 inches (that's ~45 cm, this is huge) at 90 dpi
# (the "standard" dpi for Web computations) gives 1600 px.
width_in = 160 / 9
def save(name, **options):
cwd = os.getcwd()
root = os.path.dirname(os.path.realpath(__file__))
os.chdir(root)
pp.savefig(name + ".svg", **options)
os.chdir(cwd)
def set_ratio(ratio=1.0, bottom=0.1, top=0.1, left=0.1, right=0.1):
height_in = (1.0 - left - right)/(1.0 - bottom - top) * width_in / ratio
pp.gcf().set_size_inches((width_in, height_in))
pp.gcf().subplots_adjust(bottom=bottom, top=1.0-top, left=left, right=1.0-right)
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
def Q(f, xs, ys):
X, Y = meshgrid(xs, ys)
v = vectorize
fx = v(lambda x, y: f([x, y])[0])
fy = v(lambda x, y: f([x, y])[1])
return X, Y, fx(X, Y), fy(X, Y)
-
System initially at rest.
$x(0) = 0.$ -
Black box. The system state
$x(t)$ is unknown. -
Input/Output (I/O). The input determines the output:
$$ u(t), , t\geq 0 ; \to ; y(t), , t\geq 0. $$
The variation of constants method yields
A signal is a time-dependent function
It is causal if
In the sequel, we will assume that time-dependent functions defined only for non-negative times
are zero for negative times
With this convention, they become causal signals.
The Heaviside function is the causal signal defined by
๐ท๏ธ Synonym: (unit) step signal.
The system impulse response is defined by:
-
the formula is valid for general (MIMO) systems.
๐ท๏ธ MIMO = multiple-input & multiple-output.
-
$\delta(t)$ is the unit impulse signal, we'll get back to it (in the meantime, you may assume that$D=0$ ).
When
๐ท๏ธ SISO = single-input & single-output.
Then
We identify it with its unique coefficient
Let
Then
The operation
Consider the SISO system
where
We have
When
Let
where
Compute the impulse response of the system.
Let
where
Compute the impulse response of the system.
Let
where
Compute the impulse response of the system.
The I/O behavior can be represented by
Let $$ H(t) := \left[ \begin{array}{cc} e^{t} e(t) & e^{-t} e(t) \end{array} \right] $$
Find a linear system with matrices
Is there another 4-uple of matrices
Same question but with a matrix
Since
\left[ \begin{array}{rr} e^{+t} & 0 \ 0 & e^{-t} \end{array} \right], $$
the following matrices work:
Since
$$
\begin{split}
H(t) &= (C \exp(At) B) \times e(t) + D \delta(t)\
&= ((-C) \exp(At) (-B)) \times e(t) + D \delta(t)
\end{split}
$$
changing
We can also easily add a scalar dynamics (say
The following matrices also work
Let
It Laplace transform is the function of
The Laplace transform of a signal is a complex-valued function; its domain is a subset of the complex plane.
If
(
We use the same symbol (here "$x$") to denote:
-
a signal
$x(t)$ and -
its Laplace transform
$x(s)$
They are two equivalent representations of the same "object", but different mathematical "functions".
If you fear some ambiguity, use named variables, e.g.:
The Laplace transform
-
of a vector-valued signal
$x(t) \in \mathbb{R}^n$ or -
of a matrix-valued signal
$X(t) \in \mathbb{R}^{m \times n}$
are computed elementwise.
We will only deal with rational (and causal) signals:
where:
-
$\Lambda$ is a finite subset of$\mathbb{C}$ , -
for every
$\lambda \in \Lambda$ ,$p_{\lambda}(t)$ is a polynomial in$t$ .
They are called rational since
where
Let
$$
x(t) = e^{a t} e(t), ; t\in \mathbb{R}
$$
for some
If
import sympy
from sympy.abc import t, s
from sympy.integrals.transforms \
import laplace_transform
def L(f):
return laplace_transform(f, t, s)[0]
::: slides :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
>>> from sympy.abc import a
>>> xt = sympy.exp(a*t)
>>> xs = L(xt)
>>> xs
1/(-a + s)
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
::: notebook :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
from sympy.abc import a
xt = sympy.exp(a*t)
xs = L(xt)
xs
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
Let
Compute analytically the Laplace Transform of
Compute symbolically the Laplace Transform of
By integration by parts, $$ \begin{split} x(s) &= \left[t\frac{e^{-st}}{-s} \right]^{+\infty}_0 - \int_0^{+\infty} \frac{e^{-s t}}{-s} , dt \ &= \frac{1}{s} \int_0^{+\infty} e^{-s t} , dt \ &= \frac{1}{s} \left[\frac{e^{-st}}{-s} \right]^{+\infty}_0 \ &= \frac{1}{s^2} \end{split} $$
With SymPy, we have accordingly:
>>> xt = t
>>> xs = L(xt)
>>> xs
s**(-2)
Let
Its Laplace transform
For LTI systems in standard form,
Control engineers used block diagrams to describe (combinations of) dynamical systems, with
-
"boxes" to determine the relation between input signals and output signals and
-
"wires" to route output signals to inputs signals.
-
Triangles denote gains (scalar or matrix multipliers),
-
Adders sum (or substract) signals.
-
LTI systems can be specified by:
-
(differential) equations,
-
the impulse response,
-
the transfer function.
-
Consider the system depicted in the [Feedback Block-Diagram] picture.
Compute its transfer function.
The diagram logic translates into:
and thus
or equivalently
Thus, the transfer function of this SISO system is
Why refer to
By the way, what's an impulse?
Pick a time constant
def delta(t, eps):
return exp(-t / eps) / eps * (t >= 0)
figure()
t = linspace(-1, 4, 1000)
for eps in [1.0, 0.5, 0.25]:
plot(t, delta(t, eps),
label=rf"$\varepsilon={eps}$")
xlabel("$t$"); title(r"$\delta_{\varepsilon}(t)$")
legend()
::: hidden :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
tight_layout()
save("images/impulses")
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
::: slides :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
(assuming that
-
The "limit" of the signal
$\delta_{\varepsilon}(t)$ when$\varepsilon \to 0$ is not defined as a function (issue for$t=0$ ) but as a generalized function$\delta(t)$ , the unit impulse. -
This technicality can be avoided in the Laplace domain where $$ \delta(s) = \lim_{\varepsilon \to 0} \delta_{\varepsilon}(s)
\lim_{\varepsilon \to 0} \frac{1}{1 + \varepsilon s} = 1. $$
Thus, if
-
$u(t) = \delta(t)$ then -
$y(s) = h(s) \times \delta(s) = h(s) \times 1 = h(s)$ -
and thus
$y(t) = h(t)$ .
Conclusion:
the impulse response
A system is I/O-stable if there is a
๐ท๏ธ More precisely, BIBO-stability ("bounded input, bounded output").
A pole of the transfer function
A system is I/O-stable if and only if all its poles are in the open left-plane, i.e. such that
If the system
is I/O-stable.
If
then
Therefore,
Thus, in this case, asymptotic stability and I/O-stability are equivalent.
(This equivalence actually holds under much weaker conditions.)
<style> .reveal p { text-align: left; } .reveal section img { border:0; height:50vh; width:auto; } .reveal section img.medium { border:0; max-width:50vh; } .reveal section img.icon { display:inline; border:0; width:1em; margin:0em; box-shadow:none; vertical-align:-10%; } .reveal code { font-family: Inconsolata, monospace; } .reveal pre code { background-color: white; font-size: 1.5em; line-height: 1.5em; /_ max-height: 80wh; won't work, overriden _/ } /_ .reveal .slides .left { text-align: left; } _/ input { font-family: "Source Sans Pro", Helvetica, sans-serif; font-size: 42px; line-height: 54.6px; } code span.kw { color: inherit; font-weight: normal; } code span.cf { /_ return _/ color: inherit; font-weight: normal; } code span.fl { /_ floats _/ color: inherit; } code span.dv { /_ ints _/ color: inherit; } code span.co { /_ comments _/ font-style: normal; color: #adb5bd; /_ gray 5 _/} code span.st { /_ strings _/ color: inherit; } code span.op { /_ +, = _/ color: inherit; } /*** Details ******************************************************************/ details h1, details h2, details h3{ display: inline; } details summary { cursor: pointer; list-style: '๐ '; } details[open] summary { cursor: pointer; list-style: '๐ '; } summary::-webkit-details-marker { display: none } details[open] summary ~ * { animation: sweep .5s ease-in-out; } @keyframes sweep { 0% {opacity: 0} 100% {opacity: 1} } section p.author { text-align: center; margin: auto; } </style>