From e51eba8b47faae8dd35b0b7695e61cf9fb11229b Mon Sep 17 00:00:00 2001 From: Nao Pross Date: Mon, 16 Aug 2021 09:46:07 +0200 Subject: Start something I won't ever make it in time but whatever --- tex/filters.tex | 1 + tex/lti-freq.tex | 1 + tex/lti.tex | 89 ++++++++++++++++++++++++++++++ tex/regtec.pdf | Bin 0 -> 69151 bytes tex/regtec.sty | 152 ++++++++++++++++++++++++++++++++++++++++++++++++++++ tex/signals.tex | 74 ++++++++++++++++++++++++- tex/state-space.tex | 79 +++++++++++++++++++++++++++ tex/tikz/mimo.tex | 37 +++++++++++++ 8 files changed, 431 insertions(+), 2 deletions(-) create mode 100644 tex/filters.tex create mode 100644 tex/lti-freq.tex create mode 100644 tex/lti.tex create mode 100644 tex/regtec.pdf create mode 100644 tex/regtec.sty create mode 100644 tex/state-space.tex create mode 100644 tex/tikz/mimo.tex (limited to 'tex') diff --git a/tex/filters.tex b/tex/filters.tex new file mode 100644 index 0000000..4271e35 --- /dev/null +++ b/tex/filters.tex @@ -0,0 +1 @@ +\section{Filters} diff --git a/tex/lti-freq.tex b/tex/lti-freq.tex new file mode 100644 index 0000000..892658d --- /dev/null +++ b/tex/lti-freq.tex @@ -0,0 +1 @@ +\section{Frequency response of LTI systems} diff --git a/tex/lti.tex b/tex/lti.tex new file mode 100644 index 0000000..b01a31f --- /dev/null +++ b/tex/lti.tex @@ -0,0 +1,89 @@ +\section{LTI systems} + +\subsection{Properties} +Let \(\mathcal{S}\) denote a system. +\begin{table}[H] + \begin{tabularx}{\linewidth}{p{.3\linewidth} X} + \toprule + \bfseries Property & \bfseries Meaning \\ + \midrule + static \(\leftrightarrow\)\newline dynamic & Static means that it is memoryless (in the statistical sense), whereas dynamic has memory. Static systems depend only on the input \(u\), dynamic systems on \(du/dt\) or \(\int u\,dt\). \\ + causal \(\leftrightarrow\)\newline acausal & Causal systems use only informations from the past, i.e. \(h(t < 0) = 0\). Real systems are always causal. \\ + linear \(\leftrightarrow\)\newline nonlinear & The output of a linear system does not have new frequency that were not in the input. For linear system the superposition principle is valid: \(\mathcal{S}(\alpha_1 x_1 + \alpha_2 x_2) = \alpha_1 \mathcal{S} x_1 + \alpha_2 \mathcal{S} x_2\). \\ + time invariant \newline\(\leftrightarrow\) time variant & Time invariant systems do not depend on time, but for ex. only on time differences. \\ + \midrule + SISO, MIMO & Single input single output, multiple input multiple output. \\ + BIBO & Bounded input bounded output, i.e. there are some \(A\), \(B\) such that \(|x| < A\) and \(|y| < B\) for all \(t\), equivalently \(\int_\mathbb{R} |h|\,dt < \infty\).\\ + \bottomrule + \end{tabularx} +\end{table} + +\subsection{Impulse response} +%% TODO: impulse response + +\subsection{Stability} +Let \(\mathcal{S}\) be a system with impulse response \(h(t)\) and transfer function \(H(s)\). +\begin{table}[H] + \centering + \begin{tabularx}{\linewidth}{lX} + \toprule + Stable & All poles are on the LHP\footnote{Left half plane, where \(\mathrm{Re}(s) < 0\).}. \\ + Marginally stable & There are no poles in the RHP but a simple pole on the \(j\)-axis. \\ + Instable & There are poles in the RHP or poles of hider order on the \(j\)-axis. \\ + \bottomrule + \end{tabularx} +\end{table} +\subsection{Distortion} +\subsection{Stochastic inputs} + +\iffalse +\begin{figure} +\begin{tikzpicture}[ + system/.style = {draw, thick, inner sep = 4mm, outer sep = 1mm} + ] + \matrix[row sep=3mm, column sep=1cm] (M) { + \node (x) {\(x(t)\)}; & + \node (g) {\(g(t) = y_\delta (t)\)}; & + \node (y) {\(y(t) = g(t) * x(t)\)}; \\ + + & + \node (h) {\(h(t)\)}; & + \node (yw) {\(y_\omega(t) = h(t) * x(t)\)}; \\ + + \node (in) {Input}; & + \node[system, fill=white] (sys) {LTI-System \(\mathcal{S}\)}; & + \node (out) {Response}; \\ + + \node (X) {\(X(s)\)}; & + \node (G) {\(G(s) = 1/p(s)\)}; & + \node (Y) {\(Y(s) = G(s) \cdot X(s)\)}; \\ + + \node (Xw) {\(X(\omega)\)}; & + \node (H) {\(H(\omega) = G(j\omega)\)}; & + \node (Yw) {\(Y_\omega (\omega) = H(\omega) \cdot X(\omega)\)}; \\ + }; + + \draw[thick, ->] (in) to (sys); + \draw[thick, ->] (sys) to (out); + + \begin{pgfonlayer}{background} + \coordinate (T1) at ($(x.north west) - (.8,-.1)$); + \coordinate (T2) at ($(yw.south east) + (.8,-.1)$); + + \coordinate (B1) at ($(X.north west) - (0,-.1)$); + \coordinate (B2) at ($(Y.south east) + (0,-.1)$); + + \coordinate (F1) at ($(Xw.north west) - (0,-.1)$); + \coordinate (F2) at ($(Yw.south east) + (0,-.1)$); + + \fill[color=blue!20] (T1) rectangle (T2); + \fill[color=magenta!20] (B1 -| T1) rectangle (B2 -| T2); + \fill[color=red!20] (F1 -| T1) rectangle (F2 -| T2); + % \fill[top color=blue!20, bottom color=magenta!20] + % (T1) rectangle (B2); + \end{pgfonlayer} +\end{tikzpicture} +\end{figure} +\fi + + diff --git a/tex/regtec.pdf b/tex/regtec.pdf new file mode 100644 index 0000000..5f5fc70 Binary files /dev/null and b/tex/regtec.pdf differ diff --git a/tex/regtec.sty b/tex/regtec.sty new file mode 100644 index 0000000..73494f0 --- /dev/null +++ b/tex/regtec.sty @@ -0,0 +1,152 @@ +%% +%% This is file `regtec.sty', +%% generated with the docstrip utility. +%% +%% The original source files were: +%% +%% regtec.dtx (with options: `package') +%% regtec: TikZ macros for RegT +%% Author: Nao Pross +%% E-mail: np@0hm.ch +%% License: Released under the LaTeX Project Public License v1.3c or later +%% See: http://www.latex-project.org/lppl.txt +%% +\NeedsTeXFormat{LaTeX2e}[1999/12/01] +\ProvidesPackage{regtec} + [2021/08/04 v1.00 TikZ macros for RegT] +\RequirePackage{tikz} +\usetikzlibrary{calc} +\usetikzlibrary{positioning} +\tikzset{ + rtsplit/.style = { + circle, + very thick, + draw = black, + fill = lightgray, + inner sep = 1mm, + outer sep = 1mm, + minimum size = 3mm, + }, + rtbox/.style = { + very thick, + draw = black, + fill = white, + inner sep = 2mm, + outer sep = 1mm, + minimum width = 12mm, + minimum height = 8mm, + }, + rtsum/.style = { + circle, + very thick, + draw = black, + fill = white, + inner sep = 1mm, + outer sep = 1mm, + minimum size = 3mm, + }, + rtprop/.style = { + rtbox, + path picture = { + \draw[very thick] + ($(path picture bounding box.north west) - (0,.2)$) + -- + ($(path picture bounding box.north east) - (0,.2)$); + } + }, + rtint/.style = { + rtbox, + path picture = { + \draw[very thick] (path picture bounding box.south west) + -- (path picture bounding box.north east); + } + }, + rtdiff/.style = { + rtbox, + path picture = { + \draw[very thick] + ($(path picture bounding box.north west) + (.2,0)$) + |- + ($(path picture bounding box.south east) + (0,.2)$); + }, + }, + rtdelay/.style = { + rtbox, + path picture = { + \draw[very thick] + ($(path picture bounding box.south west) + (.2,0)$) + |- + ($(path picture bounding box.north east) - (0,.2)$); + }, + }, + rtpt1/.style = { + rtbox, + path picture = { + \draw[very thick] + (path picture bounding box.south west) + to[out = 70, in = 180] + ($(path picture bounding box.north east) - (0,.2)$); + }, + }, + rtdt1/.style = { + rtbox, + path picture = { + \draw[very thick] + (path picture bounding box.north west) + to[out = -70, in = 180] + ($(path picture bounding box.south east) + (0,.2)$); + }, + }, + rtpt2/.style = { + rtbox, + path picture = { + \path (path picture bounding box.south west) + -- ++(.3,.7) node (P1) {} + -- ++(.2,-.3) node (P2) {} + -- ++(.2,.2) node (P3) {} + -- ++(.2,-.2) node (P4) {} + -- ++(.2,.2) node (P5) {} + -- ++(.1,-.1) node (P6) {}; + \draw[very thick] + (path picture bounding box.south west) + .. controls (P1) .. ($(P1)!.5!(P2)$) + .. controls (P2) .. ($(P2)!.5!(P3)$) + .. controls (P3) .. ($(P3)!.5!(P4)$) + .. controls (P4) .. ($(P4)!.5!(P5)$) + .. controls (P5) .. ($(P5)!.5!(P6)$) + .. controls (P6) .. ++(.2,0) + ; + }, + } +} +\newenvironment{rtdiagram}{% + \begin{tikzpicture} +}{% + \end{tikzpicture} +} +\iffalse +\newcommand{\dummyMacro}{} +\newenvironment{dummyEnv}{% +}{% +} +\fi +%% +%% Copyright (C) 2021 by Nao Pross +%% +%% This work may be distributed and/or modified under the +%% conditions of the LaTeX Project Public License (LPPL), either +%% version 1.3c of this license or (at your option) any later +%% version. The latest version of this license is in the file: +%% +%% http://www.latex-project.org/lppl.txt +%% +%% This work is "maintained" (as per LPPL maintenance status) by +%% Nao Pross. +%% +%% This work consists of the file regtec.dtx and a Makefile. +%% Running "make" generates the derived files README, regtec.pdf and regtec.sty. +%% Running "make inst" installs the files in the user's TeX tree. +%% Running "make install" installs the files in the local TeX tree. +%% +%% +%% End of file `regtec.sty'. diff --git a/tex/signals.tex b/tex/signals.tex index 17a5a72..1cb86ce 100644 --- a/tex/signals.tex +++ b/tex/signals.tex @@ -1,16 +1,42 @@ \section{Signals} \subsection{Classification} -%% TODO +\begin{figure}[h] + \centering + \begin{tikzpicture}[ + nodes = { + thick, + draw = black, + fill = lightgray!20, + align = center, + inner sep = 2mm, + outer sep = 1mm, + }, + sibling distance = 3cm, + ] + \node {All signals} + child {node {Class 1 \\ \(0 < E_n < \infty\)}} + child { + node {Class 2 \\ \(0 < P_n < \infty\)} + child {node {Class 2a \\ periodic}} + child {node {Class 2b \\ stochastic}} + } + ; + \end{tikzpicture} +\end{figure} \subsection{Properties} +For class 2b signals the formula for class 2a signals can used by taking \(\lim_{T\to\infty} f_\text{2a}(T)\) (if the limits exists). +The notation \(\int_T\) is short for an integral from \(-T/2\) to \(T/2\). \begin{table}[h] \everymath={\displaystyle} \[ \begin{array}{l l} \toprule - \text{\bfseries Characteristic} & \text{\bfseries Symbol and formula} \\ + \text{\bfseries Characteristic} & \text{\bfseries Symbol and formula} \\[6pt] + \text{\itshape Class 1 Signals} \\ \midrule \text{Normalized energy} & E_n = \lim_{T\to\infty} \int_T |x|^2 \,dt \\[6pt] + \text{\itshape Class 2a Signals} \\ \midrule \text{Normalized power} & P_n = \lim_{T\to\infty} \frac{1}{T} \int_T |x|^2 \,dt \\[12pt] \text{Linear mean} & X_0 = \frac{1}{T} \int_T x\, dt \\[12pt] @@ -24,3 +50,47 @@ \end{array} \] \end{table} + +\subsection{Correlation} +\paragraph{Autocorrelation} +The \emph{autocorrelation} is a measure for how much a signal is coherent, i.e. how similar it is to itself. +For class 1 signals the autocorrelation is +\[ + \varphi_{xx}(\tau) = \lim_{T\to\infty} \int_T x(t) x(t - \tau) \,dt, +\] +whereas for class 2a and 2b signals +\begin{gather*} + \varphi_{xx}(\tau) = \frac{1}{T} \int_T x(t) x(t - \tau) \,dt \quad\text{(2a)}, \\ + \varphi_{xx}(\tau) = \lim_{T\to\infty} \frac{1}{T} \int_T x(t) x(t - \tau) \,dt \quad\text{(2b)}. +\end{gather*} +Properties of \(\varphi_{xx}\): +\begin{itemize} + \item \(\varphi_{xx}(0) = X^2 = (X_0)^2 + \sigma^2\) + \item \(\varphi_{xx}(0) \geq |\varphi_{xx}(\tau)|\) + \item \(\varphi_{xx}(\tau) \geq (X_0)^2 - \sigma^2\) + \item \(\varphi_{xx}(\tau) = \varphi_{xx}(\tau + nT)\) (periodic) + \item \(\varphi_{xx}(\tau) = \varphi_{xx}(-\tau)\) (even, symmetric) +\end{itemize} +The Fourier transform of the autocorrelation \(\Phi_{xx}(j\omega) = \fourier \varphi_{xx}(t)\) is called \emph{energy spectral density} (ESD) for class 1 signals or \emph{power spectral density} (PSD) for class 2 signals. + +\paragraph{Cross correlation} +The \emph{cross correlation} measures the similarity of two different signals \(x\) and \(y\). For class 1 signals +\[ + \varphi_{xy}(\tau) = \lim_{T\to\infty} \int_T x(t) y(t-\tau) \,dt. +\] +Similarly for class 2a and 2b signals +\begin{gather*} + \varphi_{xy}(\tau) = \frac{1}{T} \int_T x(t) y(t - \tau) \,dt \quad\text{(2a)}, \\ + \varphi_{xy}(\tau) = \lim_{T\to\infty} \frac{1}{T} \int_T x(t) y(t - \tau) \,dt \quad\text{(2b)}. +\end{gather*} +Properties of \(\varphi_{xy}\): +\begin{itemize} + \item For signals with different frequencies \(\varphi_{xy}\) is always 0. + \item For stochastic signals \(\varphi_{xy} = 0\) +\end{itemize} + +\subsection{Amplitude density} +The amplitude density is the probability that a signal has a certain amplitude during a time interval \(T\). +\[ + p(a) = \frac{1}{T}\frac{dt}{dx} \in [0,1] +\] diff --git a/tex/state-space.tex b/tex/state-space.tex new file mode 100644 index 0000000..e0f7960 --- /dev/null +++ b/tex/state-space.tex @@ -0,0 +1,79 @@ +\section{State space representation} + +\begin{figure} + \centering + \resizebox{\linewidth}{!}{ + \input{tex/tikz/mimo} + } + \caption{A LTI MIMO system.} +\end{figure} + +A system described by a system of linear differential equations of \(n\)-th order, can be equivalently be described by \(n\) first order differential equations. Which can be compactly written in matrix form as +\begin{align*} + \dot{\vec{x}} &= \mx{A}\vec{x} + \mx{B}\vec{u} \\ + \vec{y} &= \mx{C}\vec{x} + \mx{D}\vec{u}. +\end{align*} +If the system is time \emph{variant} the matrices are functions of time. + +\begin{table} + \begin{tabular}{ >{\(}c<{\)} >{\(}c<{\)} l } + \toprule + \text{\bfseries Symbol} & \text{\bfseries Size} & \bfseries Name \\ + \midrule + \vec{x} & n & State vector \\ + \vec{u} & m & Output vector \\ + \vec{y} & k & Output vector \\ + \midrule + \mx{A} & n\times n & System matrix \\ + \mx{B} & m\times n & Input matrix \\ + \mx{C} & n\times k & Output matrix \\ + \mx{D} & k\times m & Feed forward matrix \\ + \bottomrule + \end{tabular} + \caption{Matrices for a state space representation} +\end{table} + +\subsection{Canonical representations} + +\subsubsection{Controllable form} + +\subsubsection{Observable form} + +\subsubsection{Diagonalized or Jordan form} + +The Jordan form diagonalizes the \(\mx{A}\) matrix. Thus we need to solve the eigenvalue problem \((\mx{A} - \lambda\mx{I})\vec{x} = \vec{0}\), which can be done by setting \(\det(\mx{A} -\lambda\mx{I}) = 0\), and solving the characteristic polynomial. The eigenvectors are obtained by plugging the \(\lambda\) values back into \((\mx{A} - \lambda\mx{I})\vec{x} = \vec{0}\), and solving an overdetermined system of equations. + +The transformation to the eigenbasis \(\mx{T}\), obtained by using the eigenvector as columns of a matrix \(\mx{T} = \begin{bmatrix} \vec{v}_1 & \cdots & \vec{v}_n \end{bmatrix}\), is then used to compute +\begin{align*} + \mx{\hat{A}} & = \mx{T}\mx{A}\mx{T^{-1}} & + \mx{\hat{B}} & = \mx{T}\mx{B} \\ + \mx{\hat{C}} & = \mx{C}\mx{T^{-1}} & + \mx{\hat{D}} & = \mx{D}. +\end{align*} + +In this form the system is described with \(n\) decoupled states \(\xi_i\) with the equations \(\dot{\vec{\xi}} = \mx{\hat{A}}\vec{\xi} + \mx{\hat{B}}\vec{u}\) and \(\vec{y} = \mx{\hat{C}}\vec{\xi} + \mx{\hat{D}} \vec{u}\). + +\subsection{Stability} +If \emph{all} eigenvalues \(\lambda\) are not zero and have a positive real part the system is asymptotically \emph{stable}. If \emph{all} eigenvalues are not zero but \emph{at least one} has a negative real part the system is \emph{unstable}. If even one eigenvalue is zero, no conclusion can be drawn. + +\subsection{Controllability} +The state controllability condition implies that it is possible --- by admissible inputs --- to steer the states from any initial value to any final value within some finite time window. A LTI state space model is controllable iff the matrix +\[ + \mx{Q} = \begin{bmatrix} + \mx{B} & \mx{A}\mx{B} & \mx{A}^2\mx{B} \cdots \mx{A}^{n-1}\mx{B} + \end{bmatrix} +\] +has \(\rank\mx{Q} = n\). Or equivalently for a SISO system, if all components of the vector \(\mx{\hat{C}}_{i} \neq 0\). + +\subsection{Observability} +Observability is a measure for how well internal states of a system can be inferred by knowledge of its external outputs. A LTI state space mode is observable iff the matrix +\[ + \mx{Q}^t = \begin{bmatrix} + \mx{C} & \mx{C}\mx{A} & \cdots & \mx{C}\mx{A}^{n-1} + \end{bmatrix} +\] +has \(\rank\mx{Q} = n\). + + +\subsection{Solutions in time domain} +\subsection{Solutions in frequency domain} diff --git a/tex/tikz/mimo.tex b/tex/tikz/mimo.tex new file mode 100644 index 0000000..02f117d --- /dev/null +++ b/tex/tikz/mimo.tex @@ -0,0 +1,37 @@ +\begin{tikzpicture}[very thick] + \matrix[ + column sep = 6mm, row sep = 4mm, + ]{ + &&& \node[rtbox] (D) {\(\mathbf{D}\)}; \\ + + \node[rtsplit] (U) {}; + & \node[rtbox] (B) {\(\mathbf{B}\)}; + & \node[rtsum] (dX) {}; + \node[above = 0mm of dX] {\(\dot{\mathbf{x}}\)}; + & \node[rtint] (I) {}; + & \node[rtsplit] (X) {}; + \node[above = 0mm of X] {\(\mathbf{x}\)}; + & \node[rtbox] (C) {\(\mathbf{C}\)}; + & \node[rtsum] (Y) {}; \\[1mm] + + &&& \node[rtbox] (A) {\(\mathbf{A}\)}; \\ + }; + + \draw[->] + (U) -- ++(-1,0) node[left] {\(\mathbf{u}\)} + (U) edge (B) + (B) edge (dX) + (dX) edge (I) + (I) -- (X) + (X) edge (C) + (C) edge (Y) + (Y) -- ++(1,0) node[right] {\(\mathbf{y}\)} + ; + + \draw[->] (U) |- (D); + \draw[->] (D) -| (Y); + + \draw[->] (X) |- (A); + \draw[->] (A) -| (dX); + +\end{tikzpicture} -- cgit v1.2.1