BSP Exp#2
BSP Exp#2
CLO 1 Date
When sampling the analog signal with an A/D board, we must satisfy two constraints:
1. We must sample long enough to include at least one full period of the lowest frequency we want to
resolve in the sample.
2. We must sample fast enough to capture the highest frequency present in the signal.
Sampling Rate:
The sampling operation samples (“chops”) the incoming signal at regular interval called “Sampling Rate”
(denoted by Ts). Sampling Rate is determined by Sampling Frequency (denoted by ƒs) as
Ts = 1/Fs
“If a function f(t) contains no frequencies higher than Ѡ cps, it is completely determined by giving its
ordinates at a series of points spaced ½ Ѡ seconds apart.”
If the signal is confined to a maximum frequency of ƒM Hz, in other words, the signal is a baseband
signal (extending from 0 Hz to maximum ƒM Hz).
In order for a faithful reproduction and reconstruction of an analog signal that is confined to a maximum
frequency Fm, the signal should be sampled at a Sampling frequency (Fs) that is greater than or equal to twice
the maximum frequency of the signal.
ƒs ≥ 2 ƒM
We can see from Figure.1
That we best reproduce the signal if we sample at least 10 points per cycle of the highest frequency (=
sampling rate is 5 times the highest frequency). If we sample the signal at just the high and low points of each
cycle (2 points per cycle - the Nyquist sampling limit), then connecting our data points
reproduces the true frequency but not a representation of the shape of the signal. If we sample any slower than
this, the connect-a-dot waveform will begin to show a lower frequency than the true signal. Aliasing refers to
this mapping of the real frequency to a different frequency. As a rule of thumb, we always want to have at least
2 data points per cycle (Nyquist criterion) but should try to achieve 5-10 data points per cycle.
Of course, the faster we sample, the more data we collect and also the measurement equipment becomes pricier
once we need high sample rates. Therefore, we will have to make a judgement on how fast we can afford to
sample our data. An analog filter or signal conditioner should always be used with any sensor to remove
unwanted or unexpected high frequency noise, which could cause aliasing in the sampled data.
Methodology:
The concepts of the Sampling Theorem and Nyquist Criteria are fundamental in the field of signal processing
and are not part of any mythology. However, I can provide we with a brief explanation of these concepts.
If we have an analog signal with a maximum frequency component of "f," then the minimum sampling rate,
often denoted as "fs," should be greater than or equal to 2f. This ensures that we can reconstruct the original
analog signal from its discrete samples without loss of information.
If the sampling rate is less than 2f, a phenomenon called aliasing occurs, and it leads to the distortion of the
original signal when it is reconstructed from the samples. To prevent aliasing, we need to follow the Nyquist-
Shannon Theorem and sample at a rate of at least 2f.
Mathematically, if a signal has a maximum frequency component of "f," the minimum required bandwidth,
often denoted as "B," should be greater than or equal to 2f. This means that if we want to transmit a signal
without distortion or loss of information, the communication channel or transmission system must have a
bandwidth of at least 2f.
Program Code:
% Signal Parameters
Fs = 100; % Sampling Frequency
F = 1.5;
Fsig = F; % Signal Frequency
T = 1/Fsig; % Signal Period
L = 1000; % Length of Signal
t = (0:L-1)*(1/Fs); % Time Vector
% Signal Generation
x = cos(2*pi*Fsig*t); % Signal
% Filter Signal
x_filtered = filter(b, a, x);
% Plot Signal
subplot(3, 1, 1);
plot(t, x ,'r');
title('Adequately Sampled Signal');
xlabel('Time');
ylabel('Amplitude');
Figure 1
Figure 2
Task1 :
Create a signal of a particular frequency and perform sampling on it.
Reconstruct the original signal from the sampled one.
Now change the values of f and fs and check the effect on sampling and reconstruction. Add your observations
and result snips in lab your report.
Program Code:
% Create a signal of a particular frequency and perform sampling on it
% Clear all the data base and close other window
clear all;
close all;
subplot(2,1,2);
plot(t,x,'g')
xlabel('Number of Samples');
ylabel('Amplitude');
title('input Cos Signal');
Results:
Figure 3
Figure 4
Figure 5
Figure 6
Observation:
Conclusion: