3EC4-23 Signal Processing Lab
3EC4-23 Signal Processing Lab
Course
Course Course
Outcom Details
Code Name
e
CO 1 Able to generate different Continuous and
Signal Processing Lab
Syllabus of 2nd Year B. Tech. (ECE) for students admitted in Session 2017-18 onwards Page 31
RAJASTHAN TECHNICAL UNIVERSITY, KOTA
SYLLABUS
II Year - III Semester: B.Tech. (Electronics & Communication Engineering)
CO-PO Mapping:
Subject
Course
PO PO PO PO PO PO PO PO PO PO PO PO
Outcom
1 2 3 4 5 6 7 8 9 10 11 12
es
2 1 2
Signal Processing
CO 1
CO 2 3 1
3EC4-23
Lab
CO 3 1 2 3 1 3
CO 4 2 1 1 2
CO 5 1 1 2 2 2
Syllabus of 2nd Year B. Tech. (ECE) for students admitted in Session 2017-18 onwards Page 32
Signal Processing LAB
INSTRUCTIONS OF LAB
DO’S
1. Student should get the record of previous experiment checked before starting the new
experiment.
2. Read the manual carefully before starting the experiment.
3. Before starting the experiment, system checked by the teacher.
4. Get your readings checked by the teacher.
5. Apparatus must be handled carefully.
6. Maintain strict discipline.
7. Keep your mobile phone switched off or in vibration mode.
8. Students should get the experiment allotted for next turn, before leaving the lab.
DON’TS
1. Do not touch or attempt to touch the mains power supply wire with bare hands.
2. Do not overcrowd the tables.
3. Do not tamper with equipments.
4. Do not leave the lab without permission from the teacher.
EXPERIMENT No. 1
AIM: Write a program to generatefollowing continuous and discrete (periodic and
aperiodic) signal.
a) 𝒚(𝒕) = 𝒔𝒊𝒏(𝟐 ∗ 𝟑. 𝟏𝟒 ∗ 𝟓 ∗ 𝒕) + 𝒄𝒐𝒔(𝟐 ∗ 𝟑. 𝟏𝟒 ∗ 𝒕);
b) 𝒚(𝒏) = (−𝟏)𝒏
c) 𝒚(𝒕) = 𝒔𝒊𝒏√𝟐𝝅𝒕 + 𝒄𝒐𝒔𝝅𝒕
d) 𝒙(𝒏) = 𝒏𝟐 + 𝟒
Signals that can be defined at discrete instant of time is called discrete time signal. Basically
discrete time signals can be obtained by sampling a continuous-time signal. It is denoted
as x(n).A discrete signal or discrete-time signal is a time series consisting of a sequence of quantities.
Unlike a continuous-time signal, a discrete-time signal is not a function of a continuous argument;
however, it may have been obtained by sampling from a continuous-time signal. When a discrete-
A signal which does not repeat itself after a certain period of time is called Non-periodic signal.
Fig 1.4 shows a periodic sine wave with period 𝑇 = 2𝜋.
% SCILAB code
clear all;
clc;
clf;
t=0:0.01:5 ;
y=sin(2*3.14*5*t) + cos(2*3.14*t);
subplot(221)
plot(t,y);
xlabel('Time');
ylabel('Amplitude');
title('Continuous Periodic Signal');
n=0:1:10;
x=(-1).^n;
subplot(222)
plot2d3(n,x);
xlabel('Time');
ylabel('Amplitude');
title('Discrete Periodic Signal');
z=sin(sqrt(2)*3.14*t)+cos(3.14*t);
subplot(223)
plot(t,z);
xlabel('Time');
ylabel('Amplitude');
title('Continuous Non-Periodic Signal');
r=n.^2+4;
subplot(224)
plot2d3(n,r);
xlabel('Time');
ylabel('Amplitude');
title ('Discrete Non-periodic signal')
OUTPUT:
DISCUSSION:
1. What is a signal.
2. Difference between continuous and discrete signal.
3. Commands difference between plot and stem function.
4. What is the difference between * and .* in MATLAB.
5. Determine which of the following signals are periodic.
1. 𝑥(𝑡) = 𝑠𝑖𝑛 15𝜋𝑡
2. 𝑥(𝑡) = sin √2 𝜋𝑡
EXPERIMENT No. 2
AIM: Write a program to plot continuous and discrete unit step signals.
SOFTWARE USED: MATLAB 7.1
THEORY:
Unit Step : Unit step signal is defined as a signal with magnitude one for time greater and equal to
zero .
We can assume it as a dc signal which got switched on at time equal to zero. Unit step signal is a
basic signal and is denoted by u(t) in continuous domain or u(n ) in discrete domain.
clear all;
clc;
clf;
t = -10:.01:10;
ut = 1.*(t>=0);
subplot(2,1,1);
plot2d2(t,ut);
xlabel('time ');
ylabel('Amplitude');
title('Continuous time Unit Step Signal');
n = -8:1:8;
un = 1.*(n>=0);
subplot(2,1,2);
plot2d3(n,un);
xlabel('time ');
ylabel('Amplitude');
title('Discrete time Unit Step Signal');
OUTP
UT:
RESULT: We have generated the continuous and discrete unit step signals. The X axis and Y
axis denotes time and amplitude respectively. The unit step function value will be 1 for positive
value of time input and zero for negative value of time input. Fig 2.3 shows continuous time unit
step signal. Fig 2.4 shows discrete time unit step signal.
DISCUSSION:
1. What is the practical application of unit step function?
2. Differentiate between unit step and unit impulse function.
3. Draw y(t)= u(t+2)- u (t-2)
4. Draw y(t)= 2u(n+1) – u(n-1)
EXPERIMENT No. 3
AIM: Write a program to generate Exponential and Ramp signals in Continuous & Discrete
domain.
The case a > 0 represents exponential growth. Some signals in unstable systems exhibit
exponential growth.
The case a < 0 represents exponential decay. Some signals in stable systems exhibit exponential
decay.
Ramp signal: A signal whose magnitude increases same as time. It can beobtained by integrating
unit step.
Continuous timer(t) = t, t >= 0
0, t<0
OUTPUT:
clear all;
clc;
clf;
t=0:1:10;
y1=1*exp(1*t);
subplot(211);
plot2d3(t,y1);
xlabel('Time');
ylabel('Amplitude');
title('Discrete Exponential Signal with scaling factor = 1 and
multiplication factor= 1');
y2=2*exp(-1*t);
subplot(212);
plot2d3(t,y2);
xlabel('Time');
ylabel('Amplitude')
OUTPUT:
clear all;
clc;
clf;
t=0:.01:10;
y1=t;
y2=-t*2;
subplot(211);
plot(t,y1);
xlabel('Time');
ylabel('Amplitude');
title('Continuous Ramp Signal with multiplication factor= 1');
subplot(212);
plot(t,y2);
xlabel('Time');
ylabel('Amplitude');
title('Continuous Ramp Signal with multiplication factor= -2');
OUTPUT:
plot2d3(t,y2);
xlabel('Time');
ylabel('Amplitude');
title('Discrete Ramp Signal with multiplication factor= -2');
OUTPUT:
RESULT: We have plotted the continuous and discrete time exponential and ramp signals. The
X axis and Y axis denotes time and amplitude respectively. Multiplication factor affects the slope
of exponential and ramp signals as shown in various plots.Fig 3.5 shows continuous time
exponential signal Fig.3.6 shows discrete time exponential signal Fig.3.7 shows continuous time
ramp signal Fig.3.8 shows discrete time ramp signal
DISCUSSION:
1. Explain the role of multiplication factor in exponential and ramp signals.
2. What are the practical applications of exponential and ramp functions?
3. Difference between stable and unstable signal.
4. What is the meaning of exponential decay?
EXPERIMENT No. 4
Problem Statement:
Suppose an input 𝑥(𝑡) = 𝑢(𝑡) – 𝑢(𝑡 − 1) is applied to a Linear Time Invariant (LTI) system
having impulse response ℎ(𝑡) = 𝑒𝑥𝑝 (𝑡) 𝑓𝑜𝑟 0 < 𝑡 < 4. Find the output of this system using
convolution
Convolution:
Convolution is defined as an operation which helps to find the output of the LTI (linear and time-
invariant) system when the impulse response of the system and the input signal are known.
(Impulse response is defined as behavior of system under unit impulse signal which is defined for
t=0 only)
(
a
)
(
b
Fig 4.1 LTI system with output represented as convolution
)
between input and impulse response
a) Continuous time system (b) discrete time system
If a continuous-time system is both linear and time-invariant, then the output Y(t) is related to the
input X(t) and impulse response (h(t)) of the system by the equation given below:
:
∞
𝑌(𝑡) = 𝑋(𝑡) ∗ ℎ(𝑡) = ∫−∞ X(τ )h(t − τ )dτ (4.1)
Equation 4.1 is also known as convolution integral between X(t) and h(t)
Similarly, if a discrete-time system is both linear and time-invariant, then the output Y(n) is related
to the input X(n) and impulse response (h(n)) of the system by the equation mentioned below:
𝑌(𝑛) = 𝑋(𝑛) ∗ ℎ(𝑛) = ∑∞ 𝑘=−∞ X(k )h(n − k) (4.2)
clf;
t=-8:.01:8;
x=3*cos(2.*t);
h=exp(-abs(t));
y=convol(x,h);
//figure
subplot(3,1,1);
plot(t,h);
xlabel('time ');
ylabel('Amplitude');
title('Impulse response');
//figure
subplot(3,1,2);
plot(t,x);
xlabel('time ');
ylabel('Amplitude');
title('Input signal');
//figure
t2=-16:.01:16
subplot(3,1,3);
plot(t2,y);
xlabel('time ');
ylabel('Amplitude');
title('Convoluted Output signal');
OUTPUT:
enter the time range for input: -3:0.01:3;
enter range for impulse response:0:0.01:4;
(
a
% SCILAB code for discrete time convolution )
(
c
)
(
Department of ECE b Page 29
)
Signal Processing LAB
clc;
clear all;
clf;
n1=0:1:12;
h=1.*(n1>=0);
n2=0:1:10;
x=exp((-1/4)*n2).*(n2>=0);
subplot(3,1,1);
plot2d3(n1,h);
xlabel('time');
ylabel('Amplitude');
title('Impulse Response');
subplot(3,1,2);
plot2d3(n2,x);
xlabel('time');
ylabel('Amplitude');
title('Input Signal');
T1=length(h);
T2=length(x);
c=convol(h,x);
t=0:1:T1+T2-2;
subplot(3,1,3);
plot2d3(t,c);
xlabel('time');
ylabel('Amplitude');
title('Convoluted Output');
OUTPUT:
enter the input: [2 3 4 5 2]
x = 2 3 4 5 2
Fig 4.3: a) input b) impulse response c) the convolved output of the Discrete System
RESULT:
a. The output of continuous LTI System with x(t) = u(t) – u(t-1) and h(t) = exp (-t) for 0<t<2
is as shown in fig 4.2.
b. The output of discrete LTI System with x(n) = [2 3 4 5 2]and h(n) = [1 2 3 4 5]
is y = [2 7 16 30 46 50 46 33 10]and shown in fig 4.3.
DISCUSSION:
1. Differentiate between linear and circular convolution.
2. Determine the unit step response of the linear time invariant system with impulse
response ℎ(𝑛) = 𝑎𝑛 𝑢(𝑛) 𝑎 < 1
3. Determine the range of values of the parameter for which linear time
invariant system with impulse response ℎ(𝑛) = 𝑎𝑛 𝑢(𝑛) is stable.
4. Describe impulse response of a function and its importance.
EXPERIMENT No. 5
AIM:Write a program to plot Adding and subtracting of two given signals using mathematical
expression.
SOFTWARE USED: Scilab 6.1.0.
THEORY:
Addition or unary plus. A+B adds the values stored in variables A and B. A and B must have the
same size, unless one is a scalar. A scalar can be added to a matrix of any size.
Subtraction or unary minus. A-B subtracts the value of B from A. A and B must have the same
size, unless one is a scalar. A scalar can be subtracted from a matrix of any size.
1. Addition
The addition of signals is very similar to traditional mathematics. That is, if x1(t) and x2(t) are the
two continuous time signals, then the addition of these two signals is expressed as x1(t) + x2(t).
The resultant signal can be represented as y(t) from which we can write
Similarly for discrete time signals, x1[n] and x2[n], we can write
2. Subtraction
Similar to the case of addition, subtraction deals with the subtraction of two or more signals in
order to obtain a new signal. Mathematically it can be represented as
clc ;
clear all;
clf;
t = -1:0.01:5;
x1 = 1;
x2 = 2;
x3 = 3- t ;
x = x1 .*( t >0 & t <1) + x2 .*( t >=1 & t <=2) + x1 .*( t >2& t
<3) ;
y = t .*( t >0 &t <1) + x1 *( t >=1 &t <=2) + x3 .*( t >2 &t <3) ;
add = x + y ;
sub = x - y ;
subplot(2,2,1);
plot(t,x);
xlabel('t') ;
ylabel('Amplitude') ;
title('input signal = x') ;
subplot(2,2,2);
plot(t,y)
xlabel('t') ;
ylabel('Amplitude') ;
title ('input signal = y') ;
subplot(2,2,3) ;
plot(t,add);
xlabel('t') ;
ylabel('Amplitude') ;
title('Addition of two signals') ;
subplot(2,2,4) ;
plot(t,sub);
xlabel('t') ;
ylabel('Amplitude') ;
title('Subtraction of two signals') ;
OUTPUT:
x = 1 2 3 4
y = 1 1 1 1
add = 1 2 4 5 1 1
sub = 1 2 2 3 -1 -1
OUTPUT:
RESULT: -The output of continuous time signal for addition and subtraction shown in fig 5.1
and the output of discrete time signal for addition and subtraction with input sequence a=[1 2 3 4]
and b=[ 1 1 1 1] and result shown in fig. 5.1.
DISCUSSION:
1. How the discrete signals are important when compared to analog signals?
2. How digital signal processing is useful in communication systems?
3. Differentiate between analog signal processing and digital signal processing.
EXPERIMENT No. 6
THEORY:
Random numbers are numbers that occur in a sequence such that two conditions are met:
The values are uniformly distributed over a defined interval or set.
It is impossible to predict future values based on past or present ones.
Random numbers are important in statistical analysis and probability theory.
rand() function is used to generate random numbers of required size.
r = rand(n) returns an n-by-n matrix containing pseudorandom values drawn from the standard
uniform distribution on the open interval (0,1).
%SCILAB Code for Random numbers generation in continuous and discrete manner
clc;
clf;
clear all;
t=0:1:9;
x=rand(1,10);
subplot(1,2,1);
plot(t,x);
xlabel('time');
ylabel('Amplitude');
title('continious random signal');
subplot(1,2,2);
plot2d3(t,x);
xlabel('time');
ylabel('Amplitude');
title('Discrete random signal');
OUTPUT:
Enter the total number which is generated N=10
x=rand(1,10)
x= 0.5068534 0.5232976 0.5596948 0.5617307 0.468176 0.7794547 0.7901072
0.9808542 0.8187066
OUTPUT:
RESULT: Uniform random numbers between amplitude range 0-1 has been plotted. The
random number N which is to be generated is taken from user by using input() function. Then
random numbers are generated using rand() function. Continuous random numbers are plotted
using plot function and discrete number is plotted using stem function. The X-axis represents
random number and Y-axis represents amplitude of that random number.10 random numbers are
generated and saved in variable y and plot is shown in fig 6.1.
DISCUSSION:
1. How can we generate signed random numbers?
2. What is the use of random numbers in study of noise?
3. Generate random numbers between amplitude 0 to 3.
4. Generate ten binary random numbers.
EXPERIMENT No. 7
THEORY:
The term random signal is used primarily to denote signals, which have randomness in its
nature source. As an example we can mention the thermal noise, which is created by the
random movement of electrons in an electric conductor.
Random signals are those signals whose behavior cannot be predicted using any past
reference. Random binary signals are digital signals which are randomly generated. It is very
important for digital communication system.
A random binary signal is a random process that can assume one of two possible values
at any time. A simple method of generating a random binary signal is to take Gaussian white
noise, filter the noise for the desired spectra and then convert the noise to a binary signal by
taking the sign of the filtered signal. The desired spectra are functions of the system time
constraints.
clc;
clf;
clear all;
u=prbs_a(20,10)
plot2d2(1:20,u,rect=[0,-1.2,20,1.2]);
xlabel('time');
ylabel('Amplitude');
title('Random Binary Wave');
OUTPUT:
Random Binary Number is = 1. 1. -1. 1. -1. -1. -1. 1. -1. 1. 1. -1. 1. 1. 1.1. -1. -
1. -1. 1.
RESULT: A random binary wave has been plotted for 𝑙 = 10 random binary data as shown
in fig 7.2.
DISCUSSION:
1. What is the importance of random binary wave in communication system?
2. How can we generate random binary data without using randint() ?
3. How the phenomenon of random signals is quite useful in dealing with noise signals?
EXPERIMENT No. 8
AIM: To generate and verify random sequences with arbitrary distributions, means and
variances for following:
(a) Rayleigh distributions
(b) Normal distributions: N (0,1).
(c) Gaussion distributions: N (m, x)
THEORY:
The term random signal is used primarily to denote signals, which have a randomness in its
nature source. As an example we can mention the thermal noise, which is created by the
random movement of electrons in an electric conductor.
Random signals are those signals whose behavior cannot be predicted using any past
reference.
Random signals are those that do not repeat with any definite sequence, but rather must be
described in terms of some probability. The characteristics of random signal are primarily
determined by its probability distribution function (PDF). There are many types of PDF
available to characterize the behavior of random signals as:
1. Gaussian distribution
2. Rayleigh distribution
3. Gamma distribution
4. Uniform Distribution
And many more……..
In this experiment we are mainly concerned about three types of distribution i.e.
1. Gaussian distribution
2. Rayleigh distribution
3. Normal distribution
Gaussian Distribution:
Gaussian distribution (also known as normal distribution) is a bell-shaped curve, and it is
assumed that during any measurement values will follow a normal distribution with an equal
number of measurements above and below the mean value.
The PDF of Gaussian distribution of random signal x is
1 (x − μ)2
( )
fx x = exp(− )
√2πσ2 2σ2
where σ2 : variance of the PDF, σ is the standard deviation, μ: mean of the PDF. The PDF of
Gaussian distribution is as shown in fig below
2. Normal Distribution:
Gaussian distribution with mean =0 and variance=1, is known to be standard normal
distribution. The PDF of normal distribution is:
1 (𝑥 )2
( )
𝑓𝑥 𝑥 = exp(− 2 )
√2𝜋 2𝜎
3. Rayleigh Distribution:
In probability theory and statistics, the Rayleigh distribution is a continuous probability
distribution for nonnegative-valued random variables. Wireless channel communication and
its related fading problem is generally characterized by Rayleigh distribution.
x (𝑥)2
𝑓𝑥 (𝑥 ) = 𝜎2 exp(− 2𝜎2 ); x>0
OUTPUT:
RESULT:
The three different probability distribution functions of Gaussian, Normal and Rayleigh are
plotted in Fig 8.3,8.4 and 8.5 respectively
DISCUSSION:
1. Define AWGN and how its useful in communication system?
2. What does the variance of Gaussian distribution specify?
3. What does the mean of probability distribution function specify?
4. Which random data is modeled by Gaussian and Rayleigh probability distribution?
EXPERIMENT No. 9
AIM: To plot the probability density functions (pdf). Find mean and variance for the above
distributions
PROBLEM STATEMENT: Find the pdf/ pmf (probability mass function) of the random
data of arbitrary length and find its mean and variance.
THEORY:
In probability theory, a probability density function (PDF), or density of a continuous
random variable, is a function whose value at any given sample (or point) in the sample
space (the set of possible values taken by the random variable) can be interpreted as
providing a relative likelihood that the value of the random variable would equal that sample.
In a more precise sense, the PDF is used to specify the probability of the random
variable falling within a particular range of values, as opposed to taking on any one value.
This probability is given by the integral of this variable’s PDF over that range—that is, it is
given by the area under the density function
Let f(x) = the probability density function (p.d.f.) .
The total area under f(x) remains 1.
Thus two conditions for a function f(x) of a continuous variable x to be a valid probability
density function are:
f x 0 x ----(9.1)
f x dx
1 ----(9.2)
Similarly, in probability and statistics, a probability mass function (PMF) is a function that
gives the probability that a discrete random variable is exactly equal to some value. The
probability mass function is often the primary means of defining a discrete probability
distribution, and such functions exist for either scalar or multivariate random
variables whose domain is discrete.
close all;
display('enter your chpoice for continous pdf or discrete
pmf')
display('Enter 1 for pdf');
display('Enter 2 for pmf');
ch=input('Enter');
switch(ch)
case 1
x=input('enter Your sequence');
r=input('enter value of rayleigh factor');
y=raylpdf(x,r);
plot(x,y);
xlabel('time');
ylabel('amplitude');
title('RAYLEIGH PDF');
display('mean of random data x is:');
m=mean(y)
display('variance of random data x is:');
v=var(y)
case 2
OUTPUT:
enter your chpoice for continous pdf or discrete pmf
Enter 1 for pdf
Enter 2 for pmf
Enter1
enter Your sequence0:0.01:3
enter value of rayleigh factor1
mean of random data x is:
m =0.3286
v =0.0393
RESULT: The pdf of Rayleigh distribution is as shown in fig 9.1 and mean and variance of
above distribution is 0.3286 and 0.0393 respectively. The PMF of the random data of length
(10) is displayed in fig 9.2 and its mean and variance is 5.8731and 8.6137respectively.
DISCUSSION:
1. What is the importance of random signals in Electronics & communication
Engineering?
2. What is the role of AWGN in digital communication system?
3. Which signal is modeled by Rayleigh Distribution?
EXPERIMENT No. B1
AIM: To design a LTI system with specific input and specific output
PROBLEM STATEMENT: Design a LTI system whose input is unit impulse signal and
output is (𝑒 −2𝑡 − 𝑒 −3𝑡 )𝑢(𝑡). (where u(t) is unit step). Also obtain the magnitude and phase
spectrum.
THEORY:
LTI system is Linear and Time-Invariant system whose output is the convolution integral of
input and impulse response of the system.
Convolution is defined as an operation which helps to find the output of the LTI (linear and
time-invariant) system when the impulse response of the system and the input signal are
known. (Impulse response is defined as behavior of system under unit impulse signal which is
defined for t=0 only)
Fig 11.1 LTI system with output represented as convolution between input and
impulse response
If a continuous-time system is both linear and time-invariant, then the output y(t) is related to
the input x(t) and impulse response (h(t)) of the system by the equation given below::
∞
𝑦(𝑡) = 𝑥 (𝑡) ∗ ℎ(𝑡) = ∫−∞ x(τ )h(t − τ )dτ (10.1)
Equation 10.1 is also known as convolution integral between x(t) and h(t).
𝑌(𝑠) = 𝑋(𝑠)𝐻(𝑠)
Where Y(s), H(s) and X(s) are the Laplace transformation of y(t), h(t) and x(t)
Designing Step:
𝐻(𝑠) = 𝑌(𝑠)/𝑋(𝑠)
𝑥(𝑡) = 𝛿(𝑡),
So, X(s)=1
1 1
𝐻 (𝑠 ) = −
𝑠+2 𝑠+3
1 1
Or 𝐻 (𝑠) = (𝑠+2)(𝑠+3) = 𝑠 2+5𝑠+6
xlabel'Frequency (rad/s)',
ylabel'Phase (degrees)'
Output
Fig 10.1: Magnitude and Phase response of LTI system with given input and output.
RESULT:The system response of the system with specified input (impulse response) and
output (𝑒 −2𝑡 − 𝑒 −3𝑡 )𝑢(𝑡).)is________________ and its phase and magnitude response is
plotted as shown in Fig 10.1
DISCUSSION:
1. Explain the LTI system and its importance in communication system.
2. Explain the principle of convolution and why it’s important in LTI system.
3. How Laplace transformation is is different from Fourier Transform?
4. Explain the drichlet’s condition for Fourier Transform.
EXPERIMENT No-B2
THEORY:
Theory:The sampling is extremely important and useful in signal processing and digital
communication. The sampling process is usually described in the time domain. With the help
of sampling process, a continuous time signal may be completely represented and recovered
from the knowledge of samples taken uniformly.
A continuous time signal is first converted to discrete time signal by sampling process. The
sufficient number of samples of the signal must be taken so that the original signal is
represented in its samples completely. Also, it should be possible to recover or reconstruct the
original signal completely from its samples.
The output sample signal is represented by the samples. These samples are maintained with a
gap, these gaps are termed as sample period or sampling interval (Ts). And the reciprocal of
the sampling period is known as “sampling frequency” or “sampling rate”. The number of
samples is represented in the sampled signal is indicated by the sampling rate.
Consider a continuous time signal x(t) whose spectrum is band limited to fm Hz. Sampling of
x(t) at a rate of fs Hz (Fs samples per second) may be achieved by multiplying x(t) by an
impulse train. Therefore it is called as ideal sampling.
The impulse train consists of unit impulse repeating periodically every T s seconds, where Ts =
1/fs.
The sampled signal may be written as
𝑔(𝑡) = 𝑥(𝑛𝑇𝑠 ) = 𝑥(𝑡). 𝛿𝑇𝑠 (𝑡)
The sampled signal in frequency domain is represented as
∞
1
𝐺 (𝜔 ) = ∑ 𝑋(𝜔 − 𝑛𝜔𝑠 )
𝑇𝑠
𝑛=−∞
The spectrum 𝐺 (𝜔) consist of 𝑋(𝜔) repeating periodically with period 𝜔𝑠 , where
2𝜋 1
𝜔𝑠 = 𝑟𝑎𝑑/ sec 𝑜𝑟𝑓𝑠 = 𝐻𝑧
𝑇𝑠 𝑇𝑠
When the sampling rate exactly equal to 2fm samples per second, then it is called Nyquist
rate.Nyquist rate is also called the minimum sampling rate.
fs = 2fm Hz
Similarly, maximum sampling interval is called Nyquist interval
Ts = 1/(2fm) Seconds
Signal Reconstruction: The process of reconstructing a continuous time signal x(t) from its
samples is known as interpolation.Interpolation gives either approximate or exact recovery of
the continuous time signal.
A signal x(t) band limited to fm Hz can be reconstructed (interpolated) completely from its
samples, by passing the sampled signal through an ideal low pass filter of cut-off frequency
fm Hz.
Therefore the filter output to g(t), which is x(t), may be expressed as
∞
clear;
clc;
close;
// Analog Signal
A =1; //Amplitude
Dt = 0.005;
t = -2:Dt:2;
//Continuous Time Signal
x = sin(2*t);
//Discrete Time Signal
Fs =input('Enter the Sampling Frequency in Hertz');//Fs =
1Hz,2Hz,4Hz,20Hz,100Hz
Ts = 1/Fs;
nTs = -2:Ts:2;
xs = sin(2*nTs);
// Analog Signal reconstruction
Dt = 0.005;
t = -2:Dt:2;
xr = xs *sinc(Fs*(ones(length(nTs),1)*t-
nTs'*ones(1,length(t))));
//Plotting the original signal and reconstructed signal
subplot(3,1,1);
plot(t,x);
xlabel('time');
ylabel('amplitude');
title('Message Signal');
subplot(3,1,2);
plot2d3(nTs,xs);
xlabel('time');
ylabel('amplitude');
title('Sampled Signal');
subplot(3,1,3);
plot(t,xr);
xlabel('time');
ylabel('amplitude');
title('Reconstructed Signal');
OUTPUT:
Fig 10.3: Message signal, Sampled signal (with sampling frequency 5Hz) and
Reconstructed Signal
RESULT:Message signal, sampled signal and reconstructed signal is shown in figure 10.3
and the sampling frequency is 5 Hz. Figure shows that message signal is reconstructed at
receivers end using interpolation if sampling frequency is fs>2fm.
DISCUSSION:
Q 1. Explain aliasing effect?
Q 2. Define Nyquist rate and Nyquist interval.
Q 3. Explain demerits of Ideal sampling.
Q 4. What is aperture effect?