0% found this document useful (0 votes)
23 views

Week 4-6 Convolution Correlation

Here are the key points about the frequency response of a moving average filter: - The frequency response is a sinc function, which has zeros at integer multiples of the sampling frequency. - For a causal moving average filter where M! = 0, the magnitude response is a sinc function scaled by 1/(M( + 1). - For a symmetric moving average filter where M% = M! , the magnitude response is a sinc function scaled by 1/(2M! + 1). - The zeros of the sinc function indicate that the moving average filter acts as a low-pass filter, removing higher frequency components from the input signal. - The cutoff frequency (-3 dB point) depends on the length of the

Uploaded by

SOHAG ALAM
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
23 views

Week 4-6 Convolution Correlation

Here are the key points about the frequency response of a moving average filter: - The frequency response is a sinc function, which has zeros at integer multiples of the sampling frequency. - For a causal moving average filter where M! = 0, the magnitude response is a sinc function scaled by 1/(M( + 1). - For a symmetric moving average filter where M% = M! , the magnitude response is a sinc function scaled by 1/(2M! + 1). - The zeros of the sinc function indicate that the moving average filter acts as a low-pass filter, removing higher frequency components from the input signal. - The cutoff frequency (-3 dB point) depends on the length of the

Uploaded by

SOHAG ALAM
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 64

Dr.

Mohammod Abdul Motin, Senior Member IEEE,


Assistant Professor,
Department of Electrical & Electronic Engineering
Rajshahi University of Engineering & Technology
Contact: [email protected]
DSP

Week Week Week Week


1-3 4-6 7-9 10-12

Analog to Digital Impulse Responses: Fourier Domain


Filters
Conversion FIR, IIR DTFT,DFT, FFT

Discrete time Correlation: Auto, FIR and IIR Filter


Z-transform
signal Cross Design

Discrete time Convolution: Inverse Z- Matlab/Python


System Linear, Circular transform Implementation
• A system is memoryless or static if its output at a given time is dependent only on the input at that same time, i.e.,
y(t) at time t depends only on x(t) at time t; y[n] at time n depends only on at time n.

• A memoryless system does not have memory to store any input values because it just operates on the current
input. For example, an ‘R’ circuit; resistor doesn’t store any current and voltage and the output depends only on
the present state of the input.

• If a system’s output depends also on the past or future state of the input, then we can call it a system with
memory. For example, an ‘RC’ circuit; in here, capacitor stores voltage. So, the output of the system depends not
only on the present state of the input as well as on the some sort of past state of input.

R R C
+ V#$% + V#$%
+ +
V!" - - V!" - -

Figure 1: An Example of Memoryless System Figure 2: An Example of a System with Memory


qExamples:
Determine if the following systems are memoryless or not

a)y(t) = x ! (t)
b)y[n] = x n + x[n − 2]

Ans:
(a)The system is memoryless because the output at time t depends only on
the input at time t.

(b) The system is not memoryless because y[n] depends not only on x n
but also on x[n − 2], which is a previous input, and thus it needs memory
to store x[n − 2] when processing the input at time n.

qPractice Problems:
Determine if the following systems are memoryless or not
a) y(t) = x(3t)
b) y[n] = 5x n All memoryless or static
c) y(t) = x(cos t)
Compression (Decimation or Down-sampling) is the process of reducing
the sampling rate. For downsampling, f" > f#

Input sampling rate ( f" ) Downsampler (↓) Output sampling rate ( f# )

Figure 3: Compressor System

amplitud amplitude
e
t $ < t # ⇛ f" > f#
t" Downsampler t#
n (↓) n
- - - - 01234 - - 0 1 2
Figure 4:
4 3 21 2 1
Downsampling
qExpression: y n = x Mn
Where, M is a positive integer and called a compressor. It has value greater than 1.
qNumerical Examples:
Suppose, a signal is sampled at a sampling rate of f! , shown in figure 5. Now compress
"
the sampled signal so that the new sampling frequency becomes ! .
#

amplitude

amplitude
8
8 6
6 4
4 2
2 n
n -8 -6 -4 -2 0 2 4 6 8
-8 -6 -4 -2 0 2 4 6 8

amplitude amplitude
Figure 5: A Numerical Example of Downsampling 8 8

2 2
n n
-2 -1 0 1 2 -2 -1 0 1 2
qPractice Problems: Downsample the following signals shown in figure 7 and 8

amplitude amplitude
Assume M=3
8 Assume M=2
6
6
4
2 4 8 4
2 6 4 6 8
2
n
-2 n
-8 -6 -4 -2 0 -2
-4
-4 -2 0 2
-6
-6
-8

Figure 7: A Numerical Example of Downsampling while M=3


Figure 8: A Numerical Example of Downsampling while M=2

Why Compression or Downsampling?


1.Compressor can be used if the output memory storage is low.
2.To reduce the complexities of signal, compressor can be used.

Cons of Over Compression


From the sampling theorem, we know that the sampling rate must be greater than twice of
the signal frequency to restore the actual signal. So, if we compress in such a way that the
sampling rate is lesser than the Nyquist rate, the actual signal can’t be recovered.
Is Accumulator a Linear
or Nonlinear System?
Difference Equation Representation of the Accumulator
What Is Moving Average System
Why Moving Average?

The general moving average system is defined by the equation:


)!
1
𝑦𝑛 = 6 𝑥[𝑛 − 𝑘]
𝑀% + 𝑀! + 1
&'()&

1
= {𝑥 𝑛 + 𝑀% + 𝑥 𝑛 + 𝑀% − 1 + 𝑥 𝑛 + 𝑀% − 2 + ⋯ + 𝑥 𝑛
𝑀% + 𝑀! + 1
+ 𝑥 𝑛 − 1 + 𝑥 𝑛 − 2 + ⋯ + 𝑥 𝑛 − 𝑀! }

The system compute the nth sample of the output sequence as the average of
(𝑀% + 𝑀! + 1) samples of the input sequence around the nth samples.

14
• If x=[0,1,2,4,4,5,8,9,5,6,4,8,2,1,3,6,9,8,9,9,6,4,2,0]
• The procedure of finding output using moving average method for 5 point is:
• 𝑦 0 =𝑥 0
'
• 𝑦1 = 𝑥 0 +𝑥 1
(
'
• 𝑦 2 = (𝑥 0 + 𝑥 1 + 𝑥 2 )
)
'
• 𝑦 3 = (𝑥 0 + 𝑥 1 + 𝑥 2 + 𝑥[3])
*
'
• 𝑦 4 = (𝑥 0 + 𝑥 1 + 𝑥 2 + 𝑥 3 + 𝑥[4])
+
'
• 𝑦 5 = (𝑥 1 + 𝑥 2 + 𝑥 3 + 𝑥 4 + 𝑥[5])
+
'
• 𝑦 6 = (𝑥 2 + 𝑥 3 + 𝑥 4 + 𝑥 5 + 𝑥[6])
+
• …….………..
'
• 𝑦 24 = (𝑥 20 + 𝑥 21 + 𝑥 22 + 𝑥 23 + 𝑥[24])
+
Difference Equation
Representation of the
Moving-Average System

Block Diagram

16
The frequency response is - 1"
1
𝐻 𝑒 ,- = = 𝑒 0,-.
𝑀' + 𝑀( + 1
./01!

For causal moving average, 𝑀!=0 then1(


1
𝐻 𝑒 ,- = = 𝑒 0,-.
𝑀( + 1
./2
,-
1 1 − 𝑒 0,-(1" 4')
𝑜𝑟, 𝐻 𝑒 =
𝑀( + 1 1 − 𝑒 0,-
𝑀 +1
1 sin[𝜔 ( ] 1
𝑜𝑟, 𝐻 𝑒 ,- = 2 𝑒 0,- "
(
𝑀( + 1 𝜔
sin
2

For symmetric moving average filter 𝑀% = 𝑀! , then

2𝑀! + 1
1 sin[𝜔 ]
𝐻 𝑒 *+
= 2
2𝑀! + 1 𝜔
sin
2
Taking different limiting value of 𝑀! 𝑎𝑛𝑑 𝑀% we can plot the magnitude and phase
of the frequency response of the moving average system.
17
taking 𝑀! = 0 𝑎𝑛𝑑 𝑀" = 4, magnitude and phase of the frequency response of the
moving average system is plotted.

Here it is noticeable that in both cases 𝐻 𝑒 *+ is periodic, as is required of the


frequency response of a discrete-time system. Also|𝐻 𝑒 *+ | falls off at “high
frequencies’’ and < 𝐻 𝑒 *+ , i.e., the phase of 𝐻 𝑒 *+ , varies linearly with ω. This
attenuation of the high frequencies suggests that the system will smooth out rapid
variations in the input sequence. in other words, the system is a rough
approximation to a lowpass filter. This is consistent with what we would intuitively
expect about the behavior of the moving-average system.
18
A discrete-time representation of a continuous-time signal obtained through periodic
sampling; i.e., a sequence of samples, x[n], is obtained from a continuous-time signal
xc(t) according to the relation

The periodic impulse train is


𝑥, 𝑡 is the product of 𝑥- 𝑡 and s(t),
𝑥, 𝑡 = 𝑥- 𝑡 ×s t

the Fourier transform of 𝑥, 𝑡 is the


convolution of the Fourier transforms 𝑋- 𝑗Ω
and 𝑆(𝑗Ω) scaled by 1/2𝜋.
1
𝑋, 𝑗Ω = 𝑋 𝑗Ω ∗ 𝑆(𝑗Ω)
2𝜋 -

Where,
• Convolution combines an input x[n] with a system impulse response h[n] to
produce a filter output y[n].

• This statement may be expressed as y[n] = x[n] * h[n] defined as:

• or, equivalently,

This sum of products (or convolution sum) is in fact a function of n that represents the
overlap between x[n] and the time-reversed and shifted version of h[n].
The number of samples N in the output signal y[n] will be

N = M1 + M2 – 1

Where,
M1 is the number of samples in sequence x[x]
M2 is the number of samples in sequence h[x]

24
• The general form of the recursive difference equation is

• The general form of the convolution is

• So the convolution has non-recursive relation with the


difference equation.

25
Digital convolution can be performed by the
following methods

• Tabular method
• Graphical method
• Formula method

26
• Step-1: List the index k covering a sufficient range.

• Step-2: List the input x[k]

• Step-3: Obtain the reversed sequence ℎ[−k] , and align the


rightmost element of ℎ[𝑛 − k] to the leftmost element of
x[𝑛].

• Step-4: Cross-multiply and sum the nonzero overlap terms


to produce y[𝑛].

• Step-5: Slide ℎ[𝑛 − k] to the right by one position.

• Step-6: Repeat Step 4; stop if all the output values are zero
or if required. 27
Example-1: Write the equation of following signals in the graphs.

Solution

a) x[n] = 2δ[n] + δ[n-1] - 2δ[n-2] or


x[n] = [2, 1, 2]

b) h[n] = δ[n] + 2δ[n-1] - δ[n-2] or


h[n] = [1, 2, -1]
Example-1: Find the output if x[n] = [2, 1, 2], and h[n] =
[1, 2, -1].

The output is the sum of the products of the input


samples and the impulse
Y[n] = response
[2, 5, -2, -5,samples.
2]
29
Example-2: Find the output using convolution if x[n] = [1, 2,
3, 1], and h[n] = [1, 2, 1, -1].

30
Example-3: Using the sequences defined in the following figure,
evaluate the digital convolution by the tabular method.
Y[n] = [9, 9, 11, 5, 2]
Example-4: Convolve the following two rectangular sequences using the tabular
method.
Exercise-1: Find the convolution of the two sequences x[n] and h[n] given by,

Exercise-2: Find the convolution of the two sequences x[n] and h[n] given by,
Exercise-3: determine the output for the first three samples of ℎ[n] using the
tabular method. Where x[n] = u[n] and h[n] = (0.25)nu[n]

Solution
41
Example-5: Using the sequences defined in Figure, evaluate the digital convolution.

42
43
44
Y[n] = [9, 9, 11, 5, 2] 45
Example-6:
Input Signal
x[n] = [2, 1, 2]
Impulse Response
h[n] = [1, 2, -1]
Output Signal
Y[n] = [2, 5, -2, -5, 2]

46
Example-7: Using the sequences defined in Figure, evaluate the digital convolution.

Y[n] = [9, 9, 11, 5, 2]

47
48
• A measure of similarity between a pair of energy
signals, x[n] and y[n], is given by the cross-
correlation sequence rxy[l]

• Where the parameter l is called lag, indicating the


time-shift between the pair of signals.

49
• There are applications where it is necessary to compare
one reference signal with one or more signals to
determine the similarity between the pair and to
determine additional information based on the similarity.

• In digital communications, a set of data symbols are


represented by a set of unique discrete-time sequences.

• If one of these sequences has been transmitted, the


receiver has to determine which particular sequence has
been received, by comparing the received signal with
every member of possible sequences from the set.

• Similarly, correlation can also be used for timing or


distance recovery purposes (e.g., RADAR, SONAR, CDMA
receiver, Ultrasound, etc.) 50
The number of samples N in the
output signal will be
N = M1 + M2 – 1
M1 is the number of samples in
sequence x1[x]
M2 is the number of samples in
sequence x2[x]

See Books Proakis for Proof


51
Example-8: Find the correlation b/w the two sequences x[n] and y[n] given by,

52
Example-9: Find the correlation b/w the two sequences x[n] and y[n] given by,

53
Cross correlation does not exhibit Commutative

54
Example-10: Find the correlation of the two sequences x[n] and
y[n] represented by,

x[n] = [1, 2, 3, 4] y[n] = [5, 6, 7, 8]

Solution

Yxy[n] = [8, 23, 44, 70, 56, 39, 20]

55
Example-11: Find the correlation of the two sequences x[n] and
y[n] represented by,

x[n] = [1, 1, 1, 1] y[n] = [1, 2, 3]

Solution

Yxy[n] = [3, 5, 6, 6, 3, 1]

56
Excersize-1: Find the correlation of the two sequences x[n] and y[n] represented by,

Excersize-2: Find the correlation of the two sequences x[n] and y[n] represented by,

57
58
59
60
Recovering a repeating pattern, or any periodic signal from its highly-
noisy version
Recovering the fundamental frequency of an otherwise random
signal

The number of samples N in the output signal will be


N = 2×M – 1
Where,
M is the number of samples in the sequence x[n]

Example: Find the auto-correlation of the following sequence


x[n] = [1, 2, 3, 4]
Solution
Yxx[n] = [4, 11, 20, 30, 20, 11, 4] 61
Example: Find the auto-correlation of the following
sequence
x[n] = [1, 2, 3, 4]

Solution
Yxx[n] = [4, 11, 20, 30, 20, 11, 4]

62
63

You might also like