# Continuous Signals¶

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 [email protected].

## Elementary Operations¶

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.

### Superposition¶

The weighted superposition $x(t)$ of two signals $x_\text{A}(t)$ and $x_\text{B}(t)$ is given as

$$x(t) = A \cdot x_\text{A}(t) + B \cdot x_\text{B}(t)$$

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}$.

In [1]:
import sympy as sym
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)$');


### Temporal Shift¶

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

$$y(t) = x(t-\tau)$$

with $\tau \in \mathbb{R}$. The signal $x(t)$ is

• shifted to the right (delayed) for $\tau > 0$
• shifted to the left (leading) for $\tau < 0$

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

$$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)$$
In [2]:
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

• Add another step to the beginning of the staircase signal by modifying above example.

### Temporal Scaling¶

The temporal scaling of a signal $x(t)$ is defined as

$$y(t) = x(a \cdot t)$$

with $a \in \mathbb{R}$. The signal $x(t)$ is

• stretched for $0 < a < 1$
• compressed for $a > 1$
• time-reversed and scaled for $a < 0$

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)$.

In [3]:
a = 1/2
y = x.subs(t, a*t)

px = sym.plot(x, (t, -3, 7), ylim=[-0.2, 1.2],
ylabel=r'$x(t)$', show=False, line_color='gray')
py = sym.plot(y, (t, -3, 7),
ylim=[-0.2, 1.2], ylabel=r'$y(t)$', show=False)
py.extend(px)
py.show()


Exercise

• Modify above example such that the signal is compressed.
• Modify above example such that the signal is scaled and time reversed. What scaling factors a lead to stretching/compression in this context?

### Temporal Flipping¶

The temporal flipping of a signal $x(t)$ is defined as

$$y(t) = x(\tau - t)$$

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.

In [4]:
tau = -1
y = x.subs(t, tau - t)

px = sym.plot(x, (t, -5, 5), ylim=[-0.2, 1.2],
ylabel=r'$x(t)$', show=False, line_color='gray')
py = sym.plot(y, (t, -5, 5), ylim=[-0.2, 1.2], ylabel=r'$y(t)$', show=False)
py.extend(px)
py.show()


Excercise

• For what value $\tau$ does the flipped signal $y(t)$ start at $t=0$?
• Realize the temporal flipping by splitting it into two consecutive operations: (i) time-reversal and (ii) temporal shift.