You are on page 1of 73

DIGITAL SIGNAL PROCESSING

BEET 3373
DR. NORHASHIMAH MOHD SAAD
SAMPLING

At the end of this topics, students should be able to:


•Explain the sampling process
•Analyze the sampling process in term of graphical and
mathematics
•Explain the Nyquist Theorem
•Apply the Discrete Time Fourier Transform

2
SAMPLING

“There’s only 10 kinds of people


in the world, those who know
binary and those who don’t.”

3
SAMPLING

• Sampling is the process of conversion from continuous-time to


discrete-time representation.

• This is necessary if it is desired to process the signal using digital


computers.

• The discrete-time signal x(n) is obtained as a result of the product of


the continuous-time signal with a set of impulse xd(t) with period Ts


x(n)  x(t ) xd (t )   x(t )d (t  nTs )
n

4
SAMPLING

Sampling Process 5
SPECTRUM OF SAMPLED SIGNALS

• If x(t) has a spectrum X(f), then the spectrum of a sampled signal x(n) is

  
X (exp( j 2f ))  FT [ x(n)]  FT x(t ) xd (t )  FT   x(t )d (t  nTs )
n 
  
   x(t )d (t  nTs ) exp( j 2ft)dt   x(n) exp( j 2fnTs )
n  n


  X ( f  nf s )
n  

6
SPECTRUM OF SAMPLED SIGNALS

|X(f)|

-fm fm f

|X(exp(j2f)
|

-2fs -fs -fm fm fs 2fs f


7
Amplitude spectra of a signal before and after sampling.
NYQUIST SAMPLING THEOREM

• Increasing the sampling frequency will increase the storage space and
processing time.

• Reducing the sampling frequency will result in aliasing due to the


overlapping between the desired and replicate spectrum components.

• The aliasing effect is minimized by using the Nyquist sampling theorem

f s  2 f max
8
Tone Freq = 1800 , Sampling Freq = 8000

Tone Freq = 1800 , Sampling Freq = 6000

Tone Freq = 1800 , Sampling Freq = 2666


Guess: Aliasing Phenomenon

Music 01

Music 02
• Time domain x(n)
• Discrete in time
• Aperiodic

• Frequency domain X(
• Continous frequency
• Periodic

• x(n) X(
•X

•x =
DISCRETE FREQUENCY
REPRESENTATIONS OF SIGNAL
• Consider DFT obtained by considering DFS in period of N, the
DFT pair defined by:
• Conversion from discrete frequency to discrete time

• X(k) x(n)
• High speed implementation of DFT.
• DFT speed up of while FFT speed up by NlogN
• Example :
• Given 2 signals as input and system impulse response as
below

1 1
x[n]  [1 0 0]
2 4
h[n]  [1 1 1 0 0]
• Determine the linear convolution(output y[n]) of these signals.
n -4 -3 -2 -1 0 1 2 3 4 5 y[n]

h( ) 1 1 1 0 0

x (0   ) 0 0 1/4 1/2 1 1

x(1   ) 0 0 1/4 1/2 1 3/2

x(2   ) 0 0 1/4 1/2 1 7/4

x(3   ) 0 0 1/4 1/2 1 ¾

x(4   ) 0 0 1/4 1/2 1 ¼

x(5   ) 0 0 1/4 1/2 1 0

y[n]  [1 3 / 2 7 / 4 3 / 4 1 / 4]
n -4 -3 -2 -1 0 1 2 3 4 5 y[n]

h( ) 1 1 1 0 0

x (0   ) 0 0 1/4 1/2 1 1

x(1   ) 0 0 1/4 1/2 1 3/2

x(2   ) 0 0 1/4 1/2 1 7/4

x(3   ) 0 0 1/4 1/2 1 ¾

x(4   ) 0 0 1/4 1/2 1 ¼

x(5   ) 0 0 1/4 1/2 1 0

y[n]  [1 3 / 2 7 / 4 3 / 4 1 / 4]
n -4 -3 -2 -1 0 1 2 3 4 5 y[n]

h( ) 1 1 1 0 0

x (0   ) 0 0 1/4 1/2 1 1

x(1   ) 0 0 1/4 1/2 1 3/2

x(2   ) 0 0 1/4 1/2 1 7/4

x(3   ) 0 0 1/4 1/2 1 ¾

x(4   ) 0 0 1/4 1/2 1 ¼

x(5   ) 0 0 1/4 1/2 1 0

y[n]  [1 3 / 2 7 / 4 3 / 4 1 / 4]
n -4 -3 -2 -1 0 1 2 3 4 5 y[n]

h( ) 1 1 1 0 0

x (0   ) 0 0 1/4 1/2 1 1

x(1   ) 0 0 1/4 1/2 1 3/2

x(2   ) 0 0 1/4 1/2 1 7/4

x(3   ) 0 0 1/4 1/2 1 ¾

x(4   ) 0 0 1/4 1/2 1 ¼

x(5   ) 0 0 1/4 1/2 1 0

y[n]  [1 3 / 2 7 / 4 3 / 4 1 / 4]
n -4 -3 -2 -1 0 1 2 3 4 5 y[n]

h( ) 1 1 1 0 0

x (0   ) 0 0 1/4 1/2 1 1

x(1   ) 0 0 1/4 1/2 1 3/2

x(2   ) 0 0 1/4 1/2 1 7/4

x(3   ) 0 0 1/4 1/2 1 ¾

x(4   ) 0 0 1/4 1/2 1 ¼

x(5   ) 0 0 1/4 1/2 1 0

y[n]  [1 3 / 2 7 / 4 3 / 4 1 / 4]
n -4 -3 -2 -1 0 1 2 3 4 5 y[n]

h( ) 1 1 1 0 0

x (0   ) 0 0 1/4 1/2 1 1

x(1   ) 0 0 1/4 1/2 1 3/2

x(2   ) 0 0 1/4 1/2 1 7/4

x(3   ) 0 0 1/4 1/2 1 ¾

x(4   ) 0 0 1/4 1/2 1 ¼

x(5   ) 0 0 1/4 1/2 1 0

y[n]  [1 3 / 2 7 / 4 3 / 4 1 / 4]
• For periodic continuous and discrete-time system, the output
y(t)&y[n] are defined as
y (t )  hT (t )  x(t ) y[n]  h[n]  x N [n]
• h(t)& h[n] are system impulse response and x(t) &x[n] are the input
signals. The operations that involved both these signals (which only
one of these signal in periodic way) known as circular convolution.
• Thus, the relationship in frequency domain will be as a
multiplication of spectrum of h(t) and x(t) as

Y( f )  H ( f )X ( f ) Y (e j 2f )  H (e j 2f ) X (e j 2f )


• Example:
• Given 2 signals as input signal and system impulse response as
below

1 1
x[n]  [1 0 0]
2 4
h[n]  [1 1 1 0 0]
• Determine the circular convolution (output y[n]) of these
signals…
n -4 -3 -2 -1 0 1 2 3 4 5 6 7 8 y[n]

1 1 0 0 1 1 1 0 0 1 1 1 0
h( )

0 0 1/4 1/2 1 1
x (0   )

x(1   ) 0 0 1/4 1/2 1

x(2   ) 0 0 1/4 1/2 1

x(3   ) 0 0 1/4 1/2 1

x(4   ) 0 0 1/4 1/2 1

x(5   )
0 0 1/4 1/2 1

x (6   ) 0 0 1/4 1/2 1

x (7   ) 0 0 1/4 1/2 1

x(8   ) 0 0 1/4 1/2 1


n -4 -3 -2 -1 0 1 2 3 4 5 6 7 8 y[n]

h( ) 1 1 0 0 1 1 1 0 0 1 1 1 0

x (0   ) 0 0 1/4 1/2 1 1

x(1   ) 0 0 1/4 1/2 1 3/2

x(2   ) 0 0 1/4 1/2 1

x(3   ) 0 0 1/4 1/2 1

x(4   ) 0 0 1/4 1/2 1

x(5   ) 0 0 1/4 1/2 1

0 0 1/4 1/2 1
x (6   )

0 0 1/4 1/2 1
x (7   )

x(8   ) 0 0 1/4 1/2 1


n -4 -3 -2 -1 0 1 2 3 4 5 6 7 8 y[n]

h( ) 1 1 0 0 1 1 1 0 0 1 1 1 0

x (0   ) 0 0 1/4 1/2 1 1

x(1   ) 0 0 1/4 1/2 1 3/2

x(2   ) 0 0 1/4 1/2 1 7/4

x (3   ) 0 0 1/4 1/2 1

x(4   ) 0 0 1/4 1/2 1

x (5   ) 0 0 1/4 1/2 1

x (6   ) 0 0 1/4 1/2 1

x (7   ) 0 0 1/4 1/2 1

x(8   ) 0 0 1/4 1/2 1


n -4 -3 -2 -1 0 1 2 3 4 5 6 7 8 y[n]

h( ) 1 1 0 0 1 1 1 0 0 1 1 1 0

x (0   ) 0 0 1/4 1/2 1 1

x(1   ) 0 0 1/4 1/2 1 3/2

x(2   ) 0 0 1/4 1/2 1 7/4

x(3   ) 0 0 1/4 1/2 1 ¾

x(4   ) 0 0 1/4 1/2 1

x(5   ) 0 0 1/4 1/2 1

x (6   ) 0 0 1/4 1/2 1

x (7   ) 0 0 1/4 1/2 1

x(8   ) 0 0 1/4 1/2 1


n -4 -3 -2 -1 0 1 2 3 4 5 6 7 8 y[n]

h( ) 1 1 0 0 1 1 1 0 0 1 1 1 0

x (0   ) 0 0 1/4 1/2 1 1

x(1   ) 0 0 1/4 1/2 1 3/2

x(2   ) 0 0 1/4 1/2 1 7/4

x (3   ) 0 0 1/4 1/2 1 ¾

x(4   ) 0 0 1/4 1/2 1 ¼

x (5   ) 0 0 1/4 1/2 1

0 0 1/4 1/2 1
x (6   )

0 0 1/4 1/2 1
x (7   )

x(8   ) 0 0 1/4 1/2 1


N -4 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   ) 0 0 1/4 1/2 1 1

0 0 1/4 1/2 1 3/2


x (6   )

0 0 1/4 1/2 1 7/4


x (7   )

x(8   ) 0 0 1/4 1/2 1 ¾


• The result of convolution will be

y[n]  [. .1 3 / 2 7 / 4 3 / 4 1 / 4 1 3 / 2 . .]
Circular convolution and zero
padding
• Zero is padding is utilized to ensure that circular convolution is
equal to linear convolution
• Zero padding is equal to both length of the signal plus 1.

length x(n)  length h(n)  1  zero padding


linear convolution

circular convolution

circular convolution with zero padding


Thank you
DIFFERENCE EQUATION
• Continous time system can be describe by differential
equation
• Discrete time system can be describe by difference equation

• TWO types of difference equation:-


• Infinite Impulse Response (IIR)
• Finite Impulse Response (FIR)
• At the end of this topics, students should be able to:
• Explain the Z-transform
• Determine the stability and ROC
• Solve discrete time system by using the Z-transform
• Apply the Z-transform
• A discrete time signal given by:

• The Laplace transform of the signal:


• Bilateral

• Consider causal system:


• Signal define as:

• Open form to close form


• Z-plane
• Z-transform properties
• ROC
• Solution of the difference equation

• Taking the Z-transform


• Transfer function

• In general form
• Roots numerator & denumerator
• Learning Outcomes:
• Apply the inverse Z-transform
• Apply the conversion techniques from analog system to digital
system.
• H(z) h(n)

• Three techniques:
• Table Look-up Method
• Partial Fraction Expansion
• Long Division
• TWO techniques:
• Impulse invariant method
• Bilinear transformation
• Learning Outcomes:

• At the end of this topics students should be able:


• Apply means, probability density function of random distribution.
• Explain the correlation function.
Signal Amplitude As A Random Variable
• The amplitude of x[n] can be modeled as a random variable. Consider an audio
signal (mp3-encoded music):

• How would we compute a histogram of the


amplitude of this signal? (Note that the example
to the right is not an actual histogram of the
above data.)

• What would be a reasonable approximation for the


amplitude histogram of this signal?
Frequency

• Uniform Distribution
• Triangular Distribution
Amplitude • Gaussian Distribution
-1.0 -0.5 0.0 0.5 1.0
Examples of Random Variables
Continuous-valued random variable: Discrete-valued random variable:
Uniform:
1
p( x)  1 0  x  1 p ( xi )  i  0,..., M  1
M
Triangular:
 i
0  x 1  M  1 0  i  M /2
 x
p( x)   p ( xi )   i
1  x 1  x  2 1  M / 2  i  M 1
Gaussian:  ( M  1)
( x  )2
1 
p ( x)  e 2 2
  x   N/A
2 

• An important part of the specification of a random variable is its probability


density function. Note that these integrate or sum to 1.
• A Gaussian distribution is completely specified by two values, its mean and
variance. This is one reason it is a popular and useful model.
• Also note that quantization systems take into account the distribution of the
data to optimize bit assignments. This is studied in disciplines such as
communications and information theory.
Mean Value Of A Random Signal (DC Value)
• The mean value of a random variable can be computed by integrating its probability
density function:

 x  E{x}   xp( x)dx

• Example: Uniformly Distributed Continuous Random Variable
1
 1
x 
2
1 1
 x  E{x}   xp ( x ) dx  0 x (1) dx   
 2 0
 (
2
 0 ) 
2
• The mean value of a discrete random variable
can be computed in an analogous manner:  x  E[ x]   xi p ( xi )
i
• But this can also be computed using the 1
sample mean (N = no. of samples):  xi
N i
 x  E[ x ] 
In fact, in more advanced coursework, you will learn this is one of many ways to estimate
the mean of a random variable (e.g., maximum likelihood).
• For a discrete uniformly distributed random variable:
M 1
 1  1 M 1 1 ( M )( M  1) ( M  1)
 x   xi p ( xi )   i   ( )  (i )  ( ) 
i i 0  M  M i 0 M 2 2
• Soon we will learn that the average value of a signal is its DC value, or its frequency
response at 0 Hz.
Variance and Standard Deviation
• The variance of a continuous random variable can be computed as:

  E{( x   x ) }   ( x   x ) 2 p( x)dx
2
x
2


• For a uniformly distributed random variable:

  E{( x   x ) }   ( x   x ) 2 p ( x) dx
2 2
x

1 3 3
 1 3 1 1
1
 ( x  ( )  ( ) (  )
1 2 2 2 2 1 1 1
 ( x   ) (1)dx        
0 2  3  3 3 24 24 12
  0
• For a discrete random variable:
 x2  E{( xi   x ) 2 }   ( xi  x ) 2 p ( xi )
i

• Following the analogy of a sample mean, this can be estimated from the data:
1
 x2 
N
 ( x[n] 
n
x )2

• The standard deviation is just the square root of the variance.


• Soon we will see that the variance is related to the correlation structure of the signal, the
power of the signal, and the power spectral density.
Correlation, Covariance and Linear Systems
• The correlation of a random signal, x(n), is defined by:
 
R (m, n)  E{x (m) x (n)}    x(m) x(n) f ( x(m), x(n))dx(m)dx(n)
 
• This can also be computed via an ensemble average:
1 N
R (m, n)  lim {  xi (m) xi (n)}
N  N
i 1
• The autocorrelation is defined as:
R (n, n)  E{x 2 (n)}
• The covariance of a random signal is defined as:
 
C (m, n)  E{( x(m)   m )( x(n)   n )}    ( x ( m)  
 
m )( x(n)   n ) f ( x( m), x( n))dx(m)dx(n)

• The variance is defined as:


C (n, n)   n2  E{( x (n)   n ) 2 }

• We can write the covariance and autocorrelation


in matrix form, and derive a relationship between them: C  R  μμt
• We can generalize the covariance and autocorrelation
to higher orders: C (3) (l , m, n)  E{( x(l )   l )( x(m)   m )( x( n)   n )}
R (3) (l1 , l 2 , l3 )  E{( x(l1 ) x(l 2 ) x(l3 ))}

You might also like