Discrete Signal Processing (DSP):

Discrete Signals

By Prof. Seungchul Lee
http://iai.postech.ac.kr/
Industrial AI Lab at POSTECH

# 1. Discrete Time SignalsÂ¶

A signal $x[n]$ is a function that maps an independent variable to a dependent variable.

In this course, we will focus on discrete-time signals $x[n]$:

• Independent variable is an integer: $n \in \mathbb{Z}$
• Dependent variable is a real or complex number: $x[n] \in \mathbb{R}$ or $\mathbb{C}$

## 1.1. Plot Real SignalsÂ¶

• plot for continuous signals in MATLAB

• stem for discrete signals in MATLAB

$$x(t) = \sin(2\pi t)$$
InÂ [2]:
%plot -s 560,200

t = 0:0.01:2;
x = sin(2*pi*t);

plot(t, x, 'linewidth', 2);
ylim([-1.1 1.1]);
xlabel('t [sec]');
ylabel('x(t)');


$$x[n] = \sin \left(\frac{2 \pi}{N}n \right)$$
InÂ [3]:
%plot -s 560,400

N = 20;
n = 0:N-1;
x = sin(2*pi/N*n);

subplot(2,1,1)
plot(n,x,'o'), axis tight, ylim([-1.2, 1.2])
subplot(2,1,2)
stem(n,x,'filled'), axis tight, ylim([-1.2, 1.2])


# 2. Signal PropertiesÂ¶

## 2.1. Finite/Infinite-Length SignalsÂ¶

• An infinite-length discrete-time signal $x[n]$ is defined for all $n \in \mathbb{Z}$, i.e., $-\infty < n < \infty$

• An finite-length discrete-time signal $x[n]$ is defined only for a finite range of $N_1 < n < N_2$

## 2.2. Periodic SignalsÂ¶

• A discrete-time signal is periodic if it repeats with period $N \in \mathbb{Z}$

$$x[n+mN] = x[n], \qquad \forall m \in \mathbb{Z}$$

• The period $N$ must be an integer
• A periodic signal is infinite in length
• Convert an infinite-length signal $x[n]$ into a finite-length signal $y[n]$ by windowing

$$y[n] = \begin{cases}x[n] & N_1 \leq n \leq N_2\\ 0 & \text{otherwise} \end{cases}$$

• Convert a finite-length signal $x[n]$ defined for $N_1 \leq n \leq N_2$ into an infinite-length signal by either
$$y[n] = \begin{cases} 0 & n < N_1\\ x[n] &N_1 \leq n \leq N_2\\ 0 & N_2 < n\end{cases}$$
• periodization with period $N$
\begin{align*}y[n] &= \sum_{m=-\infty}^{\infty}x[n-mN]\\&=\cdots + x[n+N] + x[n] + x[n-N]+ \cdots\end{align*}

## 2.3. Modular ArithmeticÂ¶

• Modular arithmetic with modulus $N$ takes place on a clock with $N$
• Modular arithmetic is inherently periodic $$\cdots = (-12)_8 = (-4)_8 = (4)_8 = (12)_8 = (20)_8 = \cdots$$

• Periodization via Modular Arithmetic
• Consider a length-$N$ signal $x[n]$ defined for $0 \leq n \leq N-1$
• A convenient way to express periodization with period $N$ is $y[n] = x[(n)_N]$
• Important interpretation
• Infinite-length signals live on the (infinite) number line
• Periodic signals live on a circle
InÂ [4]:
%plot -s 560,100

N = 8;
n = 0:N-1;
x = [0 1 2 3 4 3 2 1];

stem(n,x,'filled');
xlabel('n'), ylabel('x[n]')
xlim([-16,23]),
yticks([0,4])
box('off')


InÂ [5]:
%plot -s 560,100

%% periodic using mod
y = [];
n = -16:23;

for i = 1:length(n)
y(i) = x(mod(n(i),N)+1);
end

stem(n,y,'filled'), axis tight
xlabel('n'), ylabel('y[n]')
yticks([0,4])
box('off')


## 2.4. Finite-Length and Periodic SignalsÂ¶

• Finite-length and periodic signals are equivalent
• All of the information in a periodic signal is contained in one period (of finite length)
• Any finite-length signal can be periodized
• Conclusion: We will think of finite-length signals and periodic signals interchangeably

• Shifting infinite-length signals
• Given an infinite-length signal $x[n]$, we can shift back and forth in time via $x[n-m]$
• When $m>0, x[n-m]$ shifts to the right (forward in time, delay)
• When $m<0, x[n-m]$ shifts to the left (back in time, advance)

• Shifting periodic signals
• Periodic signals can also be shifted; consider $y[n]=x[(n)_N]$
• Shift one sample into the future: $y[n-1] = x[(n-1)_N]$

• Shifting finite-length signals
• Consider finite-length signals $x$ and $y$ defined for $0 \leq n \leq N-1$ and suppose $y[n] = x[n-1]$

\begin{align*} y[0] &= \;?\\ y[1] &= x[0]\\ y[2] &= x[1]\\ y[3] &= x[2]\\ &\vdots\\ y[N-1] &= x[N-2]\\ ?\; &= x[N-1]\\ \end{align*}
• What to put in $y[0]?$ What to do with $x[N-1]$? We do not want to invent/lose information
• Elegant solution: Assume $x$ and $y$ are both periodic with period $N$; then $y[n]=x[(n-1)_N]$
• This is called a periodic or circular shift
• Circular time reversal
$$y[n]= x[(-n)_N]$$
• Example with $N = 8$
\begin{align*} y[0] &= x[0]\\ y[1] &= x[7]\\ y[2] &= x[6]\\ y[3] &= x[5]\\ &\vdots\\ y[7] &= x[1] \end{align*}