Lab12

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 16

DEPARTMENT OF AVIONICS ENGINEERING

SUBJECT : SIGNALS & SYSTEMS LAB


Reg No: 220701005
LAB NO : 12

TITLE : Signal Sampling And Nyquist Criteria

SUBMITTED TO : Ms. Maha Intakhab Alam


SUBMITTED BY : Huzaifa Aziz
BATCH : AVIONICS 08

SECTION : A
Marks Obtained :

Remarks:

DEADLINE: May 27, 2024

DATE OF SUBMISSION: May 27, 2024


Signal Sampling
In signal processing, sampling is the reduction of a continuous-time signal to a discrete-time
signal. A common example is the conversion of a sound wave to a sequence of "samples".
A sample is the value of the signal at a point in time and/or space.
For functions that vary with time, let S(t) be a continuous function (or "signal") to be sampled,
and let sampling be performed by measuring the value of the continuous function
every T seconds, which is called the sampling interval or sampling period.
The sampling frequency or sampling rate, fs, is the average number of samples obtained in one
second, thus fs = 1/T, with the unit samples per second, sometimes referred to as hertz, for
example e.g. 48 kHz is 48,000 samples per second.

Nyquist Criteria
Nyquist criteria decides the minimum sampling rate. The Nyquist rate is defined as the
minimum sampling rate required to represent complete information about continuous signal
f(t) in its sampled form, f*(t). therefore, according to sampling theorem, the Nyquist rate is

The maximum interval of sampling can be given as

It is called Nyquist interval or Nyquist Criteria.

When Ts=1/2fm, this amounts to 2fm samples per second. This is called Nyquist rate of
sampling and 1/Ts=fs=2fm is called Nyquist frequency. In simple words, it means that the
signal must be sampled at least twice during each period of cycle of its highest frequency
component.

The minimum sampling frequency fs equal to 2fm cannot be achieved in practice because of the
difficulty in realizing ideal filters. Practically we must use the sampling frequency which is more
than twice the maximum frequency in the baseband waveform. How much ore is a matter that
depends upon the low-pass filter characteristics and how faithfully the baseband waveform
must be reproduced. If there are multiple frequency components in a signal, then the Nyquist
criteria is applied for the highest frequency component in the signal.

Types of Sampling
Basically, there are three types of sampling techniques such as:
(i) Instantaneous or Impulse sampling
(ii) Natural sampling
(iii) Flat top sampling
Out of these three, instantaneous sampling is called ideal sampling whereas natural sampling
and flat-top sampling are called practical sampling methods.

(i) Instantaneous sampling


In this type of sampling, the sampling function is a train of impulses. Fig.1(b) shows this
sampling function.

Fig.1 : (a) Baseband signal, (b) impulse train, (c) functional diagram of a switching sampler, (d)
sampled signal
Since the width of the pulse approaches zero, the instantaneous sampling gives a train of
impulses of height equal to the instantaneous value of the input signal x(t) at the sampling
instant.

(ii) Natural Sampling


As we have already discussed, the instantaneous sampling results in the samples whose width τ
approaches zero. Due to this, the power content in the instantaneously sampled pulse is
negligible. Thus, this method is not suitable for transmission purpose.
Natural sampling is a practical method. In this type of sampling, the pulse has a finite width
equal to τ.
Fig.2 : A functional diagram of a natural sampler
With the help of this natural sampler, a sampled signal g(t) is obtained by multiplication of
sampling function c(t) and input signal x(t).

Fig.3 : (a) Continuous time signal x(t), (b) Sampling function waveform i.e., periodic pulse train,
(c) Naturally sampled signal waveform g(t)

(iii) Flat Top Sampling or Rectangular Pulse Sampling


Flat top sampling like natural sampling is also a practically possible sampling method. But
natural sampling is little complex whereas flat top sampling is quite easy.
In flat-top sampling or rectangular pulse sampling, the top of the samples remains constant and
is equal to the instantaneous value of the baseband signal x(t) at the start of sampling.
The duration or width of each sample is τ and sampling rate is equal to fs = 1 / Ts.
Fig.5(a) shows the functional diagram of a sample and hold circuit which is used to generate the
flat top samples.
Fig.5 :(a) A sample and hold circuit to generate flat top samples (b) A general waveform of flat
top sampling
Fig. 5(b) shows the general waveform of flat top samples. From fig.5(b), it may be noted that
only starting edge of the pulse represents instantaneous value of the baseband signal x(t).

Fig.8 : (a) Baseband signal x(t), (b) Instantaneously sample signal s(t), (c) Constant pulse width
function h(t), (d) Flat top sampled signal g(t) obtained through convolution of h(t) and s(t)
Number of Samples
Total numbers of samples in a Sampled Signal the total number of samples can be calculated
using the following formula.
Number of Samples = Sampling Frequency/Maximum Frequency
Ns = fs/fm
where,
Number of Samples - The Number of Samples of a continuous-time signal is the total samples in
the output sample signal.
Sampling Frequency - (Measured in Hertz) - Sampling frequency is the number of samples per
second in a signal.
Maximum Frequency - (Measured in Hertz) - Maximum Frequency is the highest frequency of a
band-limited continuous-time signal.
Practice Exercises
Practice Exercise 1.
Creating an impulse train.
Code:

Output:
Practice Exercise 2.
Consider a signal y(t) = sin(wt) where “w=2πf” Take the case when f = 23 (Hertz).
a) What should be the sampling frequency (fs) according to Nyquist Criteria?
b) Plot original signal and sampled signal in MATLAB.
a) Sampling frequency should be greater than 23*2 =46Hz
b) Code:

Output:
Practice Exercise 3. Natural Sampling
Sample a sine wave using natural sampling technique.
Code:
t=0:0.001:3;
sq=square(100*t)+1;
si=sin(10*t);
a=sq.*si;
subplot(311);plot(t,si);
subplot(312); plot(t,sq);
subplot(313);plot(t,a)
Output:
Lab Tasks
Exercise 1.
The impulse train in the practice exercise 1 picks up each sample every 20 steps or every 20
samples. Vary the code so that a sample is taken every
i) 2 steps
ii) 100 steps
iii) 40 steps
what number of steps causes for better reconstruction of the signal and what number of steps
causes for the signal to be highly distorted? Explain your answer. Make the plots for -roll
number to + roll number (use last digs if roll number is a high number). Provide explanation and
analysis for each plot.

Code:

i) 2 steps

Observations: At n = 2, it is not clear but still good for sampling.


ii) 100 steps
Observations: At n = 100, it is very clear but many samples are useless

iii) 40 steps

Observations: At n = 40, it is clear but many samples are useless


Exercise 2.
If we use fs = 460 (sampling frequency) in practice exercise 1, then does it satisfy the Nyquist
Criteria? For fs = 460 how many samples are there in each cycle?
Ans: It satisfy the Nyquist Criteria because fs >> 2 * f, but it is very higher frequency so power
consumption is high.
There are 46 samples in one signal wave.

Observations: At n = 46, it is clear but many samples are useless

Exercise 3.
Consider a signal (t) = 50 cos (20πt) + 10 cos (100πt) what is the maximum frequency
component in the above signal (Remember the relation )
ANS:
1st Term:
 20π = 2πf
 f = 10 Hz
2nd Term:
 100π = 2πf
 f = 50 Hz
Max Frequency Component:
 50 Hz

a) What should be the sampling frequency according to the Nyquist Criteria?

 fs = 2 * fmax
 fs = 2 * 50 Hz
 fs = 100 Hz

b) Plot original signal and sampled signal in MATLAB. Make the plots for -roll number to +
roll number (use last digs if roll number is a high number)

CODE and Result:


c) Provide explanations and analysis.
 As we know we calculated fs on max frequency component, so
when it adds up with lower frequency, we only seeing now lower
frequency of 10Hz, and sampling is done on 50Hz frequency.

 This showing higher samples in one wave form of final signal.

Exercise 4.
Implement Flat top sampling for signals in practice exercise 3. Plot original signal and sampled
signal in MATLAB. Make the plots for -roll number to + roll number (use last digs if roll number
is a high number). Provide explanations and analysis.
CODE:

Result:

Exercise 5.
Name 3 applications of sampling and explain how they utilize the sampling technique.

Ans:
1. Digital Audio Processing:
 Application: Converts analog sound waves into digital signals.
 Utilization: Audio signals are sampled (e.g., at 44.1 kHz for CDs) by an
ADC. The digital samples are processed and stored, then played back
<---------------------------------- END ------------------------------->

You might also like