Skip to content

Commit

Permalink
Make discrete version of impulse response vs pole location figure
Browse files Browse the repository at this point in the history
  • Loading branch information
calcmogul committed Oct 5, 2024
1 parent 4b40713 commit b728d07
Show file tree
Hide file tree
Showing 7 changed files with 117 additions and 28 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ \subsection{Laplace transform}
\gls{system response} (the frequency domain) and also the x coordinate
representing the speed at which that oscillation decays and the \gls{system}
converges to zero (i.e., a decaying exponential). Figure
\ref{fig:impulse_response_poles} shows this for various points.
\ref{fig:cont_impulse_response_poles} shows this for various points.

If we move the component frequencies in the Fmajor4 chord example parallel to
the real axis to $\sigma = -25$, the resulting time domain response attenuates
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,13 @@ \subsubsection{Poles and zeroes}
The locations of the closed-loop poles in the complex plane determine the
stability of the \gls{system}. Each pole represents a frequency mode of the
\gls{system}, and their location determines how much of each response is induced
for a given input frequency. Figure \ref{fig:impulse_response_poles} shows the
\glspl{impulse response} in the time domain for transfer functions with various
pole locations. They all have an initial condition of $1$.
for a given input frequency. Figure \ref{fig:cont_impulse_response_poles} shows
the \glspl{impulse response} in the time domain for transfer functions with
various pole locations. They all have an initial condition of $1$.
\begin{bookfigure}
\input{figs/impulse-response-vs-pole-location}
\input{figs/continuous-impulse-response-vs-pole-location}
\caption{Impulse response vs pole location}
\label{fig:impulse_response_poles}
\label{fig:cont_impulse_response_poles}
\end{bookfigure}

Poles in the left half-plane (LHP) are stable; the \gls{system}'s output may
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,16 @@
\draw[->] (-4,0) -- (4,0) node[below] {\small Re};
\draw[->] (0,-2) -- (0,4) node[right] {\small Im};

% Stable: e^-1.75t * cos(1.75wt) (80/3*w for readability)
% Stable: exp(-1.75t) cos(1.75wt) (80/3*w for readability)
\drawtimeplot{-2.125cm}{2.5cm}{0.125cm}{0.44375cm}{
exp(-1.75 * \x) * cos(80/3 * 1.75 * deg(\x))}
\drawpole{-1.75cm}{1.75cm}

% Stable: e^-2.5t
% Stable: exp(-2.5t)
\drawtimeplot{-2.25cm}{0.75cm}{0.125cm}{0.125cm}{exp(-2 * \x)}
\drawpole{-2cm}{0cm}

% Stable: e^-t
% Stable: exp(-t)
\drawtimeplot{-1.125cm}{-0.75cm}{0.125cm}{0.125cm}{exp(-\x)}
\drawpole{-1cm}{0cm}

Expand All @@ -30,15 +30,15 @@
\drawtimeplot{0.25cm}{-0.75cm}{0.125cm}{0.125cm}{1}
\drawpole{0cm}{0cm}

% Unstable: e^t
% Unstable: exp(t)
\drawtimeplot{1.125cm}{0.75cm}{0.125cm}{0.125cm}{exp(\x)}
\drawpole{1cm}{0cm}

% Unstable: e^2t
% Unstable: exp(2t)
\drawtimeplot{2.25cm}{-0.75cm}{0.125cm}{0.125cm}{exp(2 * \x)}
\drawpole{2cm}{0cm}

% Unstable: e^0.75t * cos(1.75wt) (80/3*w for readability)
% Unstable: exp(0.75t) cos(1.75wt) (80/3*w for readability)
\drawtimeplot{1.5cm}{2.25cm}{0.125cm}{0.44375cm}{
exp(0.75 * \x) * cos(80/3 * 1.75 * deg(\x))}
\drawpole{0.75cm}{1.75cm}
Expand Down
63 changes: 63 additions & 0 deletions figs/discrete-impulse-response-vs-pole-location.tex
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
\begin{tikzpicture}[auto, >=latex']
% \draw [help lines] (-4,-4) grid (4,4);

% Draw main axes
\draw[->] (-4,0) -- (4,0) node[below] {\small Re};
\draw[->] (0,-4) -- (0,4) node[right] {\small Im};

% Unit circle
\draw[black] (0,0) circle (3cm);

% Exponent for the given x plot coordinate:
%
% exp(at) = x
% at = ln(x)
% a = ln(x)/t
%
% t = 50 ms

% LHP stable: exp(-21.97t)
%
% a = ln(1/3)/0.05 = -21.97
\drawtimeplot{1cm - 0.166cm}{-0.75cm}{0.125cm}{0.125cm}{exp(-21.97 * \x)}
\drawpole{1cm}{0cm}

% LHP stable: exp(-15t)
%
% a = ln(2/3)/0.05 = -8.109
\drawtimeplot{2cm}{0.75cm}{0.125cm}{0.125cm}{exp(-8.109 * \x)}
\drawpole{2cm}{0cm}

% RHP stable: exp(-10.192t) cos(19.665wt) (40/3*w for readability)
%
% a = ln(0.333+0.5i)/0.05 = -10.192 + 19.665i
\drawtimeplot{1cm}{2.25cm}{0.125cm}{0.44375cm}{
exp(-10.192 * \x) * cos(40/3 * 19.665 * deg(\x))}
\drawpole{1cm}{1.5cm}

% RHP stable: exp(-21.97t)
%
% a = ln(1/3)/0.05 = -21.97
\drawtimeplot{1cm - 0.166cm}{-0.75cm}{0.125cm}{0.125cm}{exp(-21.97 * \x)}
\drawpole{1cm}{0cm}

% RHP stable: exp(-15t)
%
% a = ln(2/3)/0.05 = -8.109
\drawtimeplot{2cm}{0.75cm}{0.125cm}{0.125cm}{exp(-8.109 * \x)}
\drawpole{2cm}{0cm}

% Integrator
\drawtimeplot{3cm + 0.166cm}{-0.75cm}{0.125cm}{0.125cm}{exp(0 * \x)}
\drawpole{3cm}{0cm}

% LHP and RHP labels
\draw (-3.5,1.5) node {LHP};
\draw (3.5,1.5) node {RHP};

% Stable and unstable labels
\draw (2.5,3.5) node {\small Unstable};
\draw (-2.5,3.5) node {\small Unstable};
\draw (-2.5,-3.5) node {\small Unstable};
\draw (2.5,-3.5) node {\small Unstable};
\end{tikzpicture}
Original file line number Diff line number Diff line change
Expand Up @@ -67,14 +67,14 @@ \section{Eigenvalues and stability}
\index{stability!poles}
The eigenvalues of $\mat{A}$ are called \textit{poles}.\footnote{This name comes
from classical control theory. See subsection \ref{subsec:poles_and_zeroes} for
more.} Figure \ref{fig:impulse_response_eig} shows the \glspl{impulse response}
in the time domain for \glspl{system} with various pole locations in the complex
plane (real numbers on the x-axis and imaginary numbers on the y-axis). Each
response has an initial condition of $1$.
more.} Figure \ref{fig:cont_impulse_response_eig} shows the \glspl{impulse
response} in the time domain for \glspl{system} with various pole locations in
the complex plane (real numbers on the x-axis and imaginary numbers on the
y-axis). Each response has an initial condition of $1$.
\begin{bookfigure}
\input{figs/impulse-response-vs-pole-location}
\input{figs/continuous-impulse-response-vs-pole-location}
\caption{Impulse response vs pole location}
\label{fig:impulse_response_eig}
\label{fig:cont_impulse_response_eig}
\end{bookfigure}

Poles in the left half-plane (LHP) are stable; the \gls{system}'s output may
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,16 @@ \section{Continuous to discrete pole mapping}

\subsection{Discrete system stability}

Eigenvalues of a \gls{system} that are within the unit circle are stable, but
why is that? Let's consider a scalar equation $x_{k + 1} = ax_k$. $a < 1$ makes
$x_{k + 1}$ converge to zero. The same applies to a complex number like
$z = x + yi$ for $x_{k + 1} = zx_k$. If the magnitude of the complex number $z$
is less than one, $x_{k+1}$ will converge to zero. Values with a magnitude of
$1$ oscillate forever because $x_{k+1}$ never decays.
Eigenvalues of a \gls{system} that are within the unit circle are stable. To
demonstrate this, consider the discrete system $x_{k + 1} = ax_k$ where $a$ is a
complex number. $|a| < 1$ will make $x_{k + 1}$ converge to zero.

\subsection{Discrete system behavior}
\begin{bookfigure}
\input{figs/discrete-impulse-response-vs-pole-location}
\caption{Impulse response vs pole location}
\label{fig:disc_impulse_response_eig}
\end{bookfigure}

As $\omega$ increases in $s = j\omega$, a pole in the discrete plane moves
around the perimeter of the unit circle. Once it hits $\frac{\omega_s}{2}$ (half
Expand All @@ -51,10 +53,9 @@ \subsection{Discrete system behavior}
other considerations like \gls{control effort}, \gls{robustness}, and
\gls{noise immunity}.

If poles from $(1, 0)$ to $(0, 0)$ on the x-axis approach infinity, then what do
poles from $(-1, 0)$ to $(0, 0)$ represent? Them being faster than infinity
doesn't make sense. Poles in this location exhibit oscillatory behavior similar
to complex conjugate pairs. See figures \ref{fig:continuous_oscillations_1p} and
Systems whose discrete poles are in the left half-plane have their outputs
reflect across the steady-state value
change sign every timestep. See figures \ref{fig:continuous_oscillations_1p} and
\ref{fig:discrete_oscillations_2p}. The jaggedness of these signals is due to
the frequency of the \gls{system} dynamics being above the Nyquist frequency
(twice the sample frequency). The \glslink{discretization}{discretized} signal
Expand Down
25 changes: 25 additions & 0 deletions preamble/macros.tex
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,31 @@
\end{scope}
\end{scope}}

% #1: xshift
% #2: yshift
% #3: xcoordshift
% #4: ycoordshift
% #5: coordinates to plot
\newcommand{\drawcoordplot}[5] {
\begin{scope}[xshift=#1-0.5cm,yshift=#2-0.5cm]
\def\xcoordshift{#3,0}
\def\ycoordshift{0,#4}

\draw[fill=headingbg] (0,0) rectangle (1,1);
\begin{scope}[shift=(\xcoordshift)]
% Draw y-axis
\draw[->] (0cm,0.05cm) -- (0cm,0.9375cm) node {};
\begin{scope}[shift=(\ycoordshift)]
% Draw x-axis
\draw[->,font=\tiny] (-0.075cm,0cm) -- (0.8125cm,0cm)
node[label={[below]90:$t$}] {};

\draw[xscale=1.2,yscale=0.3,domain=0:0.5,smooth,variable=\x,line width=0.5]
plot coordinates {#5};
\end{scope}
\end{scope}
\end{scope}}

% #1: xshift
% #2: yshift
\newcommand{\drawpole}[2] {
Expand Down

0 comments on commit b728d07

Please sign in to comment.