Mehran University of Engineering and Technology, Jamshoro Department of Electronics Engineering Digital Signal Processing 09-ES Lab # 3
Mehran University of Engineering and Technology, Jamshoro Department of Electronics Engineering Digital Signal Processing 09-ES Lab # 3
Nyquist Theorem:
It is one of the most important rules of sampling, which states that the highest frequency
in a signal which can be accurately represented is less than one-half of the sampling rate.
Mathematically,
f s 2 f max
Where,
f s is the sampling frequency and
f max is the maximum frequency component present in the signal.
For example, if we want a full 20 kHz audio bandwidth, we must sample at least twice
that fast, i.e. over 40 kHz.
Aliasing:
Aliasing is the phenomenon that results in loss of information when a continuous time
signal is reconstructed from its samples (and the Nyquist sampling theorem is violated).
The figure on the next page shows an alias.
There are two approaches to avoid aliasing. One is to raise the sampling frequency to
satisfy the sampling theorem. The other is to filter off the unnecessary high-frequency
components from the continuous-time signal. We limit the signal frequency by an
effective low-pass filter, called anti-aliasing prefilter, so that the highest frequency left
in the signal is less than half of the intended sampling rate.
Lab Tasks:
Sampling obeying the Nyquist Theorem:
Consider the following code:
%cont time
t=0:.0005:1;
f=10;
ansc=cos(2*pi*f*t);
figure;
subplot(211);
plot(t,ansc);
grid on;
xlabel('time');
ylabel('Amplitude');
title('cont time');
axis([0 1 -2 2]);
%discrete time
n=0:0.01:1;
ansd=cos(2*pi*f*n);
%k=0:length(n)-1;
subplot(212);
stem(n,ansd);
grid on;
xlabel('samples');
ylabel('Amplitude');
title('disct time');
axis([0 1 -2 2]);
1. With the help of the code given above, write a code in which the sampling
violates the Nyquist Theorem. Also sketch an approximate signal.
________________________________________________________________________
________________________________________________________________________
________________________________________________________________________
________________________________________________________________________
________________________________________________________________________
________________________________________________________________________
________________________________________________________________________
________________________________________________________________________
________________________________________________________________________
________________________________________________________________________
________________________________________________________________________
________________________________________________________________________
________________________________________________________________________
________________________________________________________________________
________________________________________________________________________
3
Sketch: