This Jupyter notebook is part of a collection of notebooks in the bachelors module Signals and Systems, Communications Engineering, Universität Rostock. Please direct questions and suggestions to Sascha.Spors@uni-rostock.de.
Operations like superposition, temporal shifting and scaling are used to construct signals with a more complex structure than the previously introduced standard signals. A set of elementary operations are introduced that are frequently used in signal processing.
The weighted superposition $x(t)$ of two signals $x_\text{A}(t)$ and $x_\text{B}(t)$ is given as
\begin{equation} x(t) = A \cdot x_\text{A}(t) + B \cdot x_\text{B}(t) \end{equation}with the complex weights $A, B \in \mathbb{C}$.
Example
The following example illustrates the superposition of two harmonic signals $x_\text{A}(t) = A \cdot \cos(\omega_\text{A} t)$ and $x_\text{B}(t) = B \cdot \cos(\omega_\text{B} t)$ with weights $A$, $B$ and angular frequencies $\omega_\text{A}$ and $\omega_\text{B}$.
import sympy as sym
%matplotlib inline
sym.init_printing()
t = sym.symbols('t', real=True)
A = .3
omA = 3
B = .5
omB = 5
x = A*sym.cos(omA*t) + B*sym.cos(omB*t)
sym.plot(x, (t, -5, 5), ylim=[-1.2, 1.2], ylabel=r'$x(t)$')
<sympy.plotting.plot.Plot at 0x10fdbc0f0>
The temporal shift of a signal $x(t)$ by the time $\tau$ is a frequently applied operation in signal processing. For instance, to model the propagation of signals from an actuator to a sensor.
The temporally shifted signal $x(t)$ is defined as
\begin{equation} y(t) = x(t-\tau) \end{equation}with $\tau \in \mathbb{R}$. The signal $x(t)$ is
Example
In order to illustrate the temporal shifting of signals, the construction of a staircase signal by a superposition of shifted rectangular signals is considered
\begin{equation} x(t) = \text{rect}\left(t - \frac{1}{2} \right) + \frac{2}{3} \cdot \text{rect}\left(t-\frac{3}{2} \right) + \frac{1}{3} \cdot \text{rect} \left(t-\frac{5}{2} \right) \end{equation}rect = sym.Heaviside(t + 1/2) - sym.Heaviside(t - 1/2)
x = rect.subs(t, t-1/2) + 2/3*rect.subs(t, t-3/2) + 1/3*rect.subs(t, t-5/2)
sym.plot(x, (t, -1, 5), ylim=[-0.2, 1.2], ylabel='$x(t)$');
Exercise
The temporal scaling of a signal $x(t)$ is defined as
\begin{equation} y(t) = x(a \cdot t) \end{equation}with $a \in \mathbb{R}$. The signal $x(t)$ is
An application of temporal scaling in signal processing is the adaption of the time scale for standard signals and the modeling of the Doppler effect.
Example
The following example illustrates the temporal scaling of the staircase signal $y(t) = x(a \cdot t)$ introduced in the previous example. The original $x(t)$ is plotted in gray, the scaled signal $y(t)$ in blue. Here stretching is realized, such that $y(t)$ is twice as long as $x(t)$.
a = .5
y = x.subs(t, a*t)
px = sym.plot(x, (t, -3, 7), ylim=[-0.2, 1.2],
ylabel=r'$y(t)$', show=False, line_color='gray')
py = sym.plot(y.subs(a, 1/2), (t, -3, 7),
ylim=[-0.2, 1.2], ylabel=r'$y(t)$', show=False)
px.extend(py)
px.show()
Exercise
a
lead to stretching/compression in this context?The temporal flipping of a signal $x(t)$ is defined as
\begin{equation} y(t) = x(\tau - t) \end{equation}for $\tau \in \mathbb{R}$. As $x(\tau - t) = x(- (t - \tau))$ the flipping operation can also be represented as a time-reversal of the signal $x(t)$ followed by a shift of $\tau$ of the reversed signal. For $\tau = 0$ this results in only a time-reversal of the signal.
The temporal flipping operation can be interpreted geometrically as a mirroring of the signal $x(t)$ at the vertical axis $t=\frac{\tau}{2}$.
Example
The following example illustrates the temporal flipping $y(t) = x(\tau - t)$ of the staircase signal $x(t)$ introduced before.
tau = -1
y = x.subs(t, tau - t)
px = sym.plot(x, (t, -5, 5), ylim=[-0.2, 1.2],
ylabel=r'$y(t)$', show=False, line_color='gray')
py = sym.plot(y, (t, -5, 5), ylim=[-0.2, 1.2], ylabel=r'$y(t)$', show=False)
px.extend(py)
px.show()
Excercise
Copyright
The notebook is provided as Open Educational Resource. Feel free to use the notebook for your own educational purposes. The text is licensed under Creative Commons Attribution 4.0, the code of the IPython examples under the MIT license. Please attribute the work as follows: Signals and Systems by Sascha Spors.