Download as pdf or txt
Download as pdf or txt
You are on page 1of 33

Digital Signal Processing EEC 222

MEC 222

Chapter One
Introduction to Digital Signals Processing

Associate Professor/ Mohamed Saber


Lecture 2
20-2-2023
1. Discrete Signal
A typical digital signal x(n) is shown in Figure, where both the time and the amplitude of the digital signal are
discrete. Notice that the amplitudes of the digital signal samples are given and sketched only at their
corresponding time indices, where
 x(n) represents the amplitude of the nth sample
 n is the time index or sample number.

X(0) : zeroth sample amplitude at sample number n = 0,


X(1) : first sample amplitude at sample number n =1,
X(2) : second sample amplitude at sample number n = 2,
X(3) :third sample amplitude at sample number n =3, and so on. 2
1. Discrete Signal
 Furthermore, next Figure illustrates the digital samples whose amplitudes are the discrete encoded values
represented in the digital signal (DS) processor.

 Precision of the data is based on the number of bits used in the DSP system. As shown in Figure for the floating-
point DS processor, we can identify the first five sample amplitudes at their time indices as follows:

x(0)=2.25
X(1)=2
X(2)=2
X(3)=-1
X(4)=0
3
..
2- Generation of Digital Signals

 The procedure to develop the digital sequence from its analog signal function is as follows:

 Assuming that an analog signal x(t) is uniformly sampled at the time interval of 𝑇𝑇, where T is the
sampling period.

 the corresponding digital function (sequence) x(n) gives the instant encoded values of the analog
signal x(t) at all the time instants t = 𝑛𝑛𝑇𝑇 and can be achieved by substituting time 𝑡𝑡 = 𝑛𝑛𝑛𝑛 into the
analog signal

𝑥𝑥 𝑛𝑛 = 𝑥𝑥 𝑡𝑡 � = 𝑥𝑥(𝑛𝑛𝑛𝑛)
𝑡𝑡=𝑛𝑛𝑛𝑛

4
Example 1 Assume we have a DSP system with a sampling time interval of 125 microseconds.
a. Convert each of following analog signals x(t) to a digital signal x(n)
𝑥𝑥 𝑡𝑡 = 10𝑒𝑒 −5000𝑡𝑡 u(t) y 𝑡𝑡 = 10sin(2000𝜋𝜋𝜋𝜋)u(t)
b. Determine and plot the sample values from each obtained digital function.
Solution
a) Since T=0.000125 S t=nT=nX0.000125=0.000125 n
𝑥𝑥 𝑛𝑛 = 10𝑒𝑒 −5000×0.000125𝑛𝑛 𝑢𝑢 𝑛𝑛𝑛𝑛 = 10𝑒𝑒 −0.625𝑛𝑛 𝑢𝑢(𝑛𝑛)
y 𝑛𝑛 = 10 sin 2000𝜋𝜋 ∗ 0.000125𝑛𝑛 𝑢𝑢 𝑛𝑛𝑛𝑛 = 10 sin 0.25𝜋𝜋𝜋𝜋 𝑢𝑢(𝑛𝑛)

b)

5
Periodic DS
Discrete signal x(n) is periodic if
x(n) = x(n + kN)

where
k is an integer
N is the period, which is an integer as well
A periodic discrete signal is shown in Fig. 3. This signal has a period of 4. This periodic signal repeats every N = 4
instances.

6
Example 2

Consider the two signals in Fig . Are they periodic?

Solution

Perdiodic Aperiodic

7
3. BASIC DISCRETE-TIME SIGNALS

3.1 Unit Step Sequence

Like the continuous-time unit step, we define the unit step sequence u[n] as

8
3.2 Unit Impulse

In discrete time, we define unit impulse sequence as

Properties of the unit impulse signal

1- 𝑥𝑥 𝑛𝑛 𝛿𝛿 𝑛𝑛 = 𝑥𝑥 0 𝛿𝛿 𝑛𝑛

2- 𝑥𝑥 𝑛𝑛 𝛿𝛿 𝑛𝑛 − 𝑘𝑘 = 𝑥𝑥 𝑘𝑘 𝛿𝛿 𝑛𝑛 − 𝑘𝑘

3- 𝛿𝛿 𝑛𝑛 = 𝑢𝑢 𝑛𝑛 − 𝑢𝑢(𝑛𝑛 − 1)

4- 𝑢𝑢 𝑛𝑛 = ∑𝑛𝑛𝑘𝑘=−∞ 𝛿𝛿(𝑘𝑘)

9
3.3 Unit Ramp Sequence

 The unit ramp sequence is defined as

10
3.5 Sinusoidal Sequence
The sinusoidal sequence or a discrete-time sinusoid is given by

where
𝜃𝜃𝑜𝑜 : 𝐷𝐷𝐷𝐷𝐷𝐷𝐷𝐷𝐷𝐷𝐷𝐷𝐷𝐷 𝑓𝑓𝑓𝑓𝑓𝑓𝑓𝑓𝑓𝑓𝑓𝑓𝑓𝑓𝑓𝑓𝑓𝑓
1
𝜃𝜃0 = 𝜔𝜔𝜔𝜔 = 2𝜋𝜋𝜋𝜋 (𝑟𝑟𝑟𝑟𝑟𝑟/𝑠𝑠𝑠𝑠𝑠𝑠𝑠𝑠𝑠𝑠𝑠𝑠𝑠𝑠)
𝑓𝑓𝑠𝑠

or
2𝜋𝜋
𝜃𝜃0 = 𝜔𝜔𝜔𝜔 = 𝑇𝑇 (𝑟𝑟𝑟𝑟𝑟𝑟)
𝑇𝑇 𝑠𝑠

FIG. A discrete-time sinusoidal sequence, x(n) = cos(0.125 𝜋𝜋 n) u(n).


11
3.5 Sinusoidal Sequence

Period of sinusoid sequence

2𝜋𝜋𝜋𝜋
𝜃𝜃0 = 𝜔𝜔𝜔𝜔 = (𝑟𝑟𝑟𝑟𝑟𝑟)
𝑓𝑓𝑠𝑠

𝜃𝜃𝑜𝑜 : 𝐷𝐷𝐷𝐷𝐷𝐷𝐷𝐷𝐷𝐷𝐷𝐷𝐷𝐷 𝑓𝑓𝑓𝑓𝑓𝑓𝑓𝑓𝑓𝑓𝑓𝑓𝑓𝑓𝑓𝑓𝑓𝑓


x(n) is periodic if

where k is an integer. This can be written as

 If N/k is a rational number (ratio of two integers), then x(n) is periodic and the period is

2𝜋𝜋
 The smallest value of N that satisfies the previous equation is called the fundamental period. If is not a
𝜃𝜃𝑜𝑜
rational number, then x(n) is not periodic.
12
Example 3 Consider the following continuous signal for the current

𝑖𝑖 𝑡𝑡 = cos(20𝜋𝜋𝜋𝜋)
which is sampled at 12.5 ms. Will the resulting discrete signal be periodic?

Solution
The continuous radian frequency is 𝜔𝜔 = 20𝜋𝜋 𝑟𝑟𝑟𝑟𝑟𝑟/𝑠𝑠. Since the sampling interval Ts is 12.5 ms = 0.0125 s,

2𝜋𝜋 𝜋𝜋
𝑥𝑥 𝑛𝑛 = cos 2𝜋𝜋 10 0.0125 𝑛𝑛 = cos 𝑛𝑛 = cos 𝑛𝑛
8 4

Since for periodicity, we must have


2𝜋𝜋 𝑁𝑁
=
𝜃𝜃0 𝑘𝑘

we get
2𝜋𝜋 𝑁𝑁 16𝜋𝜋 8
= = =
2𝜋𝜋/8 𝑘𝑘 2𝜋𝜋 1

For k = 1, we have N = 8, which is the fundamental period.


13
Example 4
Are the following discrete signals periodic? If so, what is the period for each?
1- 𝑥𝑥 𝑛𝑛 = 2 cos( 2 𝜋𝜋𝜋𝜋) 2- 𝑥𝑥 𝑛𝑛 = 20 cos(𝜋𝜋𝜋𝜋)

Solution

1 𝜃𝜃1 = 2𝜋𝜋 2𝜋𝜋 2


=
2 𝜋𝜋 2
This is clearly not a rational number, and therefore, the signal is not periodic.

2 𝜃𝜃2 = 𝜋𝜋 2𝜋𝜋 2
= Rational number  Periodic signal
𝜋𝜋 1

To find the fundamental period 2 𝑁𝑁


=
1 𝑘𝑘

For k = 1, we get N = 2. Thus, N is the fundamental period.


14
Example 5
Consider the following complex sinusoidal discrete signals:

𝑗𝑗𝑗𝑗8𝜋𝜋
1- 2𝑒𝑒 𝑗𝑗𝑗𝑗 2- 𝑒𝑒 𝑗𝑗𝑗𝑗𝑗𝑗 3- 𝑒𝑒 𝑗𝑗2𝜋𝜋𝜋𝜋+2 4- 𝑒𝑒 3

Solution

1 2𝜋𝜋 𝑁𝑁
= Not rational  Not periodic
1 𝑘𝑘

2𝜋𝜋 𝑁𝑁
2 = Rational  Periodic For k=1, N=2
𝜋𝜋 𝑘𝑘

2𝜋𝜋 𝑁𝑁 Rational  Periodic


3 = For k=1, N=1
2𝜋𝜋 𝑘𝑘

2𝜋𝜋 𝑁𝑁
4 = Rational  Periodic For k=4, N=3
8𝜋𝜋 𝑘𝑘
15
3
Example 6

Write down expressions for the sequences shown in Fig.

Solution

𝑥𝑥 𝑛𝑛 = 𝛿𝛿 𝑛𝑛 + 2𝛿𝛿(𝑛𝑛 − 3) y 𝑛𝑛 = 𝛿𝛿 𝑛𝑛 + 2 + 2𝛿𝛿 𝑛𝑛 + 1 + 3𝛿𝛿 𝑛𝑛 + 2𝛿𝛿(𝑛𝑛 − 2)

16
Example 7 Represent the following discrete signals using impulse signals

y 𝑛𝑛 = 3𝛿𝛿 𝑛𝑛 + 𝛿𝛿 𝑛𝑛 − 1 + 2𝛿𝛿 𝑛𝑛 − 2 − 4𝛿𝛿(𝑛𝑛 − 3)

𝑥𝑥 𝑛𝑛 = 𝛿𝛿 𝑛𝑛 + 2 + 2𝛿𝛿 𝑛𝑛 + 1 + 3𝛿𝛿 𝑛𝑛 + 4𝛿𝛿 𝑛𝑛 − 1 − 𝛿𝛿(𝑛𝑛 − 2)

17
4. Basic Operation on Discrete Signals

4.1 Reflection Operation

𝑥𝑥 𝑛𝑛 = 𝑥𝑥[−𝑛𝑛] 18
4. Basic Operation on Discrete Signals

4.2 Time Shifting

U(n) U(-n) 𝛿𝛿(𝑛𝑛)

… …
0 1 2 3 4 n -3 -2 -1 0 n 0 n

U(n-2) U(-n-2) 𝛿𝛿(𝑛𝑛 − 2)

… …
0 1 2 3 4 n -3 -2 -1 0 n 0 2 n

U(-n+2) 𝛿𝛿(𝑛𝑛 + 2)
U(n+2)


-3 -2 -1 0 1 2 4 n -2 0 n
-2 -1 0 1 2 3 4 n

19
Example 8

A discrete-time signal is shown in Fig. Sketch each of the following signals:


(a) x[n−3], (b) x[−n + 3]

Solution

20
Example 9

A discrete-time signal h(k) is shown in Fig. Sketch each of the following


signals:
(a) h[1-k], (b) h[2-k] (c) h(-1-k)

(a) (b)

(c)

21
Example 10
Consider the discrete pulse in Figure Write this pulse as a sum of discrete step signals.

𝑢𝑢 𝑛𝑛 + 2 − 𝑢𝑢[𝑛𝑛 − 3]

𝑢𝑢[𝑛𝑛 − 3] 22
𝑢𝑢 𝑛𝑛 + 2
4. Basic Operation on Discrete Signals

4.3 Addition and Subtraction

Consider the two discrete signals x1(n) and x2(n). The addition/subtraction of these two signals is y(n) where

4.4 Scalar Multiplication

A scalar multiplication of the discrete signal x(n) is the signal y(n) where

where A is the scaling factor.

4.5 Modulation

 Consider the two discrete signals x1(n) and x2(n). The resulting signal y(n)

y[n] is called the modulation of x1(n) and x2(n). y(n) is a discrete signal found by multiplying the sample values of
x1(n) and x2(n) at every instant.
23
Example 11

Consider the following signal:


Find

Solution

x(−n) is x(n) shifted about the zero position, which is

2. x(−n + 1) is x(−n) shifted to the left 1 unit and it is

3. 2x(−n + 1) is x(−n + 1) scaled by 2 and is

We add these two signals at the n = 0 index to get

24
Example 12

Consider the signal shown in Fig. find y(n)=x(n)x(n)

Solution

x(n) multiplied by x(n) is called the element-by-element


multiplication and is

25
4. Basic Operation on Discrete Signals
4.6 Combined Operations

We may have multiple operations among input discrete signals. One operation may be represented as

where we have scaling, shifting, and addition operations combined. In other operations you may have the output
y(n) presented as

where you have x1(n) scaled, then the modulated signal resulting from x2(n) and x3(n) is subtracted from 2x1(n).

26
4. Basic Operation on Discrete Signals

4.7 Time Scaling

27
Example 13

Consider the discrete signal as shown in Figure Find


1- x(2n) 2- x(n/2) 3- x(2n+1)

Solution
𝑛𝑛
1- The new time axis in this case is 𝑛𝑛𝑛𝑛𝑛𝑛𝑛𝑛 = 𝑜𝑜𝑜𝑜𝑜𝑜
2
where 𝑛𝑛𝑜𝑜𝑜𝑜𝑜𝑜 is the
index of the given x(n). The indices are arranged as in the following
𝑛𝑛
with the help of the equation 𝑛𝑛𝑛𝑛𝑛𝑛𝑛𝑛 = 𝑜𝑜𝑜𝑜𝑜𝑜 .
2

𝒏𝒏𝒐𝒐𝒐𝒐𝒐𝒐 𝒏𝒏𝒐𝒐𝒐𝒐𝒐𝒐 X[2n]


𝒏𝒏𝒏𝒏𝒏𝒏𝒏𝒏 =
𝟐𝟐
-3 -1.5 0
-2 -1 1
-1 -0.5 0
0 0 0
1 0.5 0
2 1 -1
3 1.5 0 28
Example 13

2- The new time axis in this case is 𝑛𝑛𝑛𝑛𝑛𝑛𝑛𝑛 = 2 𝑛𝑛𝑜𝑜𝑜𝑜𝑜𝑜 where 𝑛𝑛𝑜𝑜𝑜𝑜𝑜𝑜 is the index of the given x(n). The indices are
arranged as in the following with the help of the equation 𝑛𝑛𝑛𝑛𝑛𝑛𝑛𝑛 = 2 𝑛𝑛𝑜𝑜𝑜𝑜𝑜𝑜 .
𝒏𝒏𝒐𝒐𝒐𝒐𝒐𝒐 𝒏𝒏𝒏𝒏𝒏𝒏𝒏𝒏 = 𝟐𝟐 𝒏𝒏𝒐𝒐𝒐𝒐𝒐𝒐 X[n/2]
-3 -6 0
-2 -4 1
-1 -2 1
0 0 0
1 2 -1
2 4 -1
3 6 0

3- x(2n + 1) is x(2n) shifted left by one unit and is

29
Sheet 2

1 Sketch each of the following special digital sequences:

a) 5𝛿𝛿(𝑛𝑛) b) −2𝛿𝛿(𝑛𝑛 − 5) c) −5𝑢𝑢(𝑛𝑛) d) 5𝑢𝑢(𝑛𝑛 − 2)

2 Calculate the first eight sample values, and sketch each of them

a) x n = 0.5𝑛𝑛 𝑢𝑢(𝑛𝑛)
b) x n = 5 sin(0.2𝜋𝜋𝜋𝜋)𝑢𝑢(𝑛𝑛)
c) x n = 5 cos 0.1𝜋𝜋𝜋𝜋 + 300 𝑢𝑢(𝑛𝑛)
d) x n = 5 0.75 𝑛𝑛 sin(0.1𝜋𝜋𝜋𝜋)𝑢𝑢(𝑛𝑛)
3 Sketch each of the following sequences:

a) x = {3,0, −𝟎𝟎. 𝟓𝟓, 5,0,0,0, −4} b) x = {1, 𝟎𝟎, −2,0,0, −4}

30
Sheet 2

4 Write an expression for the following sequence shown in Figure using impulse response

5 Assume that a DS processor with a sampling time interval of 0.01 second converts the following analog
signals x(t) to a digital signal ; x(n)determine the digital sequence for each of the analog signals.

a) x t = e−50𝑡𝑡 𝑢𝑢(𝑡𝑡) b) x t = 5 sin 20𝜋𝜋𝜋𝜋 𝑢𝑢(𝑡𝑡)

c) x t = 10 cos(40𝜋𝜋𝜋𝜋 + 300 )𝑢𝑢(𝑡𝑡) d) x t = 10𝑒𝑒 −100𝑡𝑡 sin(15𝜋𝜋𝜋𝜋)𝑢𝑢(𝑡𝑡)


31
Sheet 2
6 Consider the following discrete signals:

Find 𝑥𝑥1 𝑛𝑛 + 𝑥𝑥2 (𝑛𝑛) and 𝑥𝑥1 𝑛𝑛 . 𝑥𝑥2 (𝑛𝑛)

7 Consider the following signals:

𝑥𝑥 𝑛𝑛 = 0.5 𝑛𝑛 cos(2𝜋𝜋𝜋𝜋 + 𝜋𝜋) y 𝑛𝑛 = 5 cos 2𝜋𝜋𝜋𝜋 + 𝜋𝜋 + 3

Are the signals periodic?

8 Check the periodicity for each of the following signals for 0 ≤ n ≤ ∞. If they are periodic, what is the period?

a) x t = cos(2𝜋𝜋𝜋𝜋 + 𝜋𝜋)
𝜋𝜋
b) x t = 0.1 n cos(5𝜋𝜋𝜋𝜋 + )
2

c) x t = cos( 2𝜋𝜋𝜋𝜋)
d) x t = 2cos(2𝑛𝑛 − 𝜋𝜋)
32
Sheet 2
9 A discrete-time signal is shown in Figure Sketch each of the following signals:
(a) x[n−3], (b) x[−n + 3], (c) x[2n]. (d) x[n + 2], (e) x[n/2]

You might also like