Digital Communication
Digital Communication
Digital Communication
4. Give sampled output as input to the reconstruction circuit and make sure that the output
of reconstruction circuit is same as the input signal.
5. Plot waveforms.
CIRCUIT DIAGRAM:
EXP NO: 2
IMPLEMENTATION OF DELTA MODULATOR
AIM:
To design and implement delta modulator.
COMPONENTS REQUIRED:
1.
2.
3.
4.
5.
IC 311
IC 741
IC 7474
Function generator
CRO
THEORY:
Delta modulation is a differential PCM scheme in which the difference signal is encoded into
single bit. This single bit is transmitted per sample to indicate whether the signal is larger or
smaller than the previous sample. The LM311 chip is used in circuit as a comparator and the
output of comparator is fed to the sample and hold circuit made by the D flip flop. The clock
frequency is selected at the sampling rate pulses at the output. The output of D-flip flop is fed to
an integrator and the integrator output is given as one input to the comparator as the quantized
approximation of modulating signal m(t). The modulating signal m(t) and its quantized
approximation m(t) is applied to the comparator, comparator provides a high level output when
m(t) is greater than m(t).
PROCEDURE:
1. Verify whether the components are in good condition or not. Set up the circuit as per
circuit diagram.
2. Apply input signal to the circuit.
3. Observe the output on the CRO and note down the frequency and amplitude of the
sampled signal.
4. Plot waveforms.
CIRCUIT DIAGRAM:
Expected Output:
EXP NO: 3
CIRCUIT DIAGRAM:
PROCEDURE:
1. Verify whether the components are in good condition or not. Set up the circuit as per
circuit diagram.
2. Apply input signal to the circuit.
3. Observe the output on the CRO and note down the frequency and amplitude of the
sampled signal.
4. Plot waveforms.
EXP NO: 4
GENERATION AND DETECTION OF BASK AND BFSK SIGNALS
AIM:
To design and setup a circuit for BASK and BFSK generation and detection.
COMPONENTS REQUIRED:
THEORY:
CIRCUIT DIAGRAM:
PROCEDURE:
1. Verify whether the components are in good condition or not. Set up the circuit as per
circuit diagram.
2. Apply input signal to the circuit.
3. Observe the output on the CRO and note down the frequency and amplitude of the
sampled signal.
4. Give sampled output as input to the reconstruction circuit and make sure that the output
of reconstruction circuit is same as the input signal.
5. Plot waveforms.
EXP NO: 5
INTRODUCTION TO SCILAB
AIM
1. Study of SCILAB basics and getting familiar with the environment.
2. Generation of various waveforms in continuous and discrete form.
Unit impulse signal
Unit step signal
Unit ramp signal
Triangular signal
Exponential signal
Sinusoidal signal
THEORY
Scilab is an open source software for numerical mathematics and scientific visualization.
It is capable of interactive calculations as well as automation of computations through
programming. It provides all basic operations on matrices through built-in functions so that the
trouble of developing and testing code for basic operations are completely avoided. Its ability to
plot 2D and 3D graphs helps in visualizing the data we work with. All these make Scilab an
excellent tool for teaching, especially those subjects that involve matrix operations. Further, the
numerous toolboxes that are available for various specialized applications make it an important
tool for research. Being compatible with Matlab, all available Matlab M-files can be directly
used in Scilab with the help of the Matlab to Scilab translator.Scicos, a hybrid dynamic systems
modeler and simulator for Scilab, simplifies simulations. The greatest features of Scilab are that
it is multiplatform and is free. It is available for many operating systems including Windows,
Linux and MacOS X.
Scilab is a scientific software package which was developed since 1990 by researchers
from INRIA(French National Institute for Research in Computer Science and Control) andENPC
(National School of Bridges and Roads), it is now maintained anddeveloped by
ScilabConsortium since its creation in May 2003 and integrated into Digiteo Foundation in July
2008. The current version is 5.5.1 (February2010).Since 1994 it is distributed freely along with
source code through the Internet and is currently being used in educational and industrial
environments around the world. From version 5 it is released under the GPL compatible CeCILL
license.
When you start up Scilab, you see a window called Scilab console. The user enters Scilab
commands at the prompt (-->). But many of thecommands are also availablethrough the menu at
the top. Themost important menu for abeginner is the Help menu.Clicking on the Help menu
opensup the Help Browser, showing alist of topics on which help isavailable. Clicking on the
relevanttopic takes you to hyperlinkeddocuments similar to web pages. The codes for the
programs are written as SciNotes by selecting a blank note from the tope top left corner of the
Scilab Console.
PROCEDURE
1. Start Scilab on PC and Scilab console window opens. Create a new blank SciNote.
2. The code for the required program is typed and saved as Scilab SCE file with an extension .sci
3. The continuous plots are made using the function plot and discrete plots are made using the
function plot2d3 with the corresponding x axis and y axis variables written inside(). To view
all the plots in the same window the function subplot is used.
4. The typed program is run using the execute.
5. The results and the errors in the program are displayed in the console window.
PROGRAM :
GENERATION OF DISCRETE WAVEFORMS
clc;
clear all;
clf;
//UNIT IMPULSE
y=[zeros(1,10),ones(1,1),zeros(1,10)];
t=-10:1:10;
subplot(2,3,1)
plot2d3(t,y);
title('unit impulse');xlabel('t');ylabel('amp');
//UNIT STEP
x=[zeros(1,10),ones(1,11)];
t=-10:1:10;
subplot(2,3,2)
plot2d3(t,x);
title('unit step');xlabel('t');ylabel('amp');
//UNIT RAMP
t=0:1:10;
m=2; // m=1 for unit ramp , m can take any values.
y=m*t;
subplot(2,3,3);
plot2d3(t,y);
title('ramp');xlabel('t');ylabel('amp');
//TRIANGULAR FUNCTION
p=50;
t=0:1:49;
for n=1:p/2
a(n)=n;
end
for n=p/2+1:p
a(n)=p-n;
end
subplot(2,3,4)
plot2d3(t,a);
//EXPONENTIAL FUNCTION
t=0:1:25;
y=exp(0.03*t);
subplot(2,3,5)
plot2d3(t,y);
//SINUSOIDAL FUNCTION
t=0:0.0001:0.01;
f=100;
y=0.5*sin(2*%pi*f*t);
subplot(2,3,6)
plot2d3(t,y);
title('unit impulse');xlabel('t');ylabel('amp');
//UNIT STEP
x=[ones(1,20)];
t=0:1:19;
subplot(2,3,2)
plot(t,x);
title('unit step');xlabel('t');ylabel('amp');
//UNIT RAMP
t=0:1:10;
m=2; // m=1 for unit ramp , m can take any values.
y=m*t;
subplot(2,3,3);
plot(t,y);
title('ramp');xlabel('t');ylabel('amp');
//TRIANGULAR FUNCTION
p=50;
t=0:1:49;
for n=1:p/2
a(n)=n;
end
for n=p/2+1:p
a(n)=p-n;
end
subplot(2,3,4)
plot(t,a);
//EXPONENTIAL FUNCTION
t=0:1:25;
y=exp(0.03*t);
subplot(2,3,5)
plot(t,y);
//SINUSOIDAL FUNCTION
t=0:0.0001:0.01;
f=100;
y=0.5*sin(2*%pi*f*t);
subplot(2,3,6)
plot(t,y);
RESULT AND DISCUSSION:
1. Familiarized SCILAB
2. Basic experiments to generate different waveforms in discrete and continuous time
domain were done.
EXP NO: 6
BASIC SIGNAL OPERATIONS USING Scilab
AIM
2.For the given two signals in discrete domain perform signal addition and subtraction
3.Perform linear convolution on given two sequences.
THEORY
The time reversal of a discrete time signal x(n) can be obtained by folding the sequence
about n=0 and the folded sequence is represented by x(-n). The signal time delayed by 3 samples
is obtained by shifting the sequence to right by 3 samples and it is represented with x(n-3). The
signal time advanced by 2 samples is obtained by shifting the sequence to left by 2 samples and
it is represented with x(n+2).
For discrete-time signals the sum of two sequences and difference of two sequences is
obtained by adding and subtracting the sequence values at the same index n for which the
sequences are defined.
The convolution between the input sequence x(n) and impulse response h(n) is computed
using the function convol as y=convol(x,h). If the length of x(n) is N1 and length of h(n) is
N2 , then the length of y(n) is N1+N2-1. The length of x(n) and h(n) is found using the function
length(x) and length(h) . If the sequence x(n) is starting at n1 and h(n) at n2, then sequence
y(n) starts at n1+n2.
PROGRAM
//folded sequence
clc;
clear all;
clf;
x=[0 2 3 4 5];
n=-2:1:2;
m=-n;
y=x;
subplot(2,2,1)
plot2d3(n,x);
title('orginal sequence');
subplot(2,2,2)
plot2d3(m,y);
title('folded sequence');
// shifted sequence
x=[1 2 3 4 5];
n=-2:1:2;
k=n-2;// advanced seq
subplot(2,2,3)
plot2d3(k,x);
title('advanced sequence');
l=n+3;//delayed sequence
subplot(2,2,4)
plot2d3(l,x);
title('delayed sequence');
title('1st Signal');
subplot(2,2,2)
plot2d3 (n1,y2);
xlabel('time');
ylabel('amplitude');
title('2nd Signal');
subplot(2,2,3)
plot2d3(n1,y3);
xlabel('time');
ylabel('amplitude');
title('Addition of two Signals');
subplot(2,2,4)
plot2d3(n1,y4);
xlabel('time');
ylabel('amplitude');
title('Subtraction of two Signals');
// LINEAR CONVOLUTION
clear;
close;
clc;
h=[1 2 2 3];
n2=0:length(h)-1;
x=[2 -1 3];
n1=0:length(x)-1;
y=convol(x,h);
n=0:length(h)+length(x)-2;
subplot(2,2,1)
plot2d3(n2,h);
xlabel("time---->");
ylabel("amplitude----->");
title("IMPULSE RESPONSE");
subplot(2,2,2)
plot2d3(n1,x);
xlabel("time---->");
ylabel("amplitude----->");
title("INPUT RESPONSE");
subplot(2,2,3)
plot2d3(n,y);
xlabel("time---->");
ylabel("amplitude----->");
title("LINEAR CONVOLUTION");
EXP NO: 7
PERFORMANCE
EVALUTAION
OF
DIGITAL
MODULATION
AND
AIM:
To evaluate the performance of BASK and BPSK using Scilab.
THEORY:
PROGRAMS:
BASK:
//sin wave
clc;
fm=5;
t=linspace(0,1,500);
sgl=0.2*sin(2*%pi*fm*t);
subplot(3,3,1)
plot(t,sgl);
//msg sig
msg=[];
for i=1:500
if sgl(i)>0 then
msg=[msg 1];
else
msg=[msg 0];
end
end
subplot(3,3,2)
plot(t,msg);
title('msg signal-square wave');
xlabel('time');
ylabel('amplitube');
//carrier sig
fc=30;
car=.5*sin(2*%pi*fc*t);
subplot(3,3,3)
plot(t,car);
title('carrier signal');
xlabel('time');
ylabel('amplitube');
//mod sig
ask=msg.*car;
subplot(3,3,4)
plot(t,ask);
title('modulated signal');
xlabel('time');
ylabel('amplitube');
//receive signal
for k=1:5
A=0.5;
snr_db=[2 4 6 8 10];
snr(k)=10^(snr_db(k)/10);
sigma(k)=A/sqrt(snr(k));
disp(sigma(k));
theory_ber(k)=0.5*erfc(0.707*sqrt(snr(k)));
disp(theory_ber(k));
end
//demod sig
n=rand(1,500);
for q=1:5
ask_noise=ask+sigma(q)*n;
dem=ask_noise.*car;
subplot(3,3,5)
plot(t,dem);
msg2=[];
for i=1:500
if dem(i)>0 then
msg2=[msg2 1];
else
msg2=[msg2 0];
end
end
count=0;
for i=1:500
if (msg2(i)-msg(i)~=0) then
count=count+1;
end
end
BER(q)=count/500;
disp(BER(q));
end
subplot(3,3,6)
plot(t,msg2);
disp(BER);figure;
plot2d1("ll",snr_db,BER);
title("SNR vs BER");
xlabel("SNR in db");
ylabel("BERin db");
Expected Output:
BPSK:
//sin wave
clc;
fm=5;
t=linspace(0,1,500);
sgl=0.2*sin(2*%pi*fm*t);
subplot(3,3,1)
plot(t,sgl);
//msg sig
msg=[];
for i=1:500
if sgl(i)>0 then
msg=[msg 1];
else
msg=[msg -1];
end
end
subplot(3,3,2)
plot(t,msg);
title('msg signal-sine wave');
xlabel('time');
ylabel('amplitude');
//carrier sig
fc=30;
car=.5*sin(2*%pi*fc*t);
subplot(3,3,3)
plot(t,car);
title('carrier signal');
xlabel('time');
ylabel('amplitude');
//mod sig
ask=msg.*car;
subplot(3,3,4)
plot(t,ask);
title('modulated signal');
xlabel('time');
ylabel('amplitude');
//receive signal
for k=1:5
A=0.5;
snr_db=[2 4 6 8 10];
snr(k)=10^(snr_db(k)/10);
sigma(k)=A/sqrt(snr(k));
theory_ber(k)=0.5*erfc(sqrt(snr(k)));
disp(theory_ber(k));
end
//demod sig
n=rand(1,500);
for q=1:5
ask_noise=ask+sigma(q)*n;
dem=ask_noise.*car;
subplot(3,3,5)
plot(t,dem);
msg2=[];
for i=1:500
if dem(i)>0 then
msg2=[msg2 1];
else
msg2=[msg2 -1];
end
end
count=0;
for i=1:500
if (msg2(i)-msg(i)~=0) then
count=count+1;
end
end
BER(q)=count/500;
disp(BER(q));
end
subplot(3,3,6)
plot(t,msg2);
disp(BER);
figure;
plot2d1("ll",snr_db,BER,style=+2);
set(gca(),"auto_clear","off");
plot2d1("ll",snr_db,theory_ber,style=+3);
legend('Practical','Theoritical');
title('SNR V/S BER');
xlabel('SNR IN DB ------->');
ylabel('BER IN DB ------->');
EXPECTED OUTPUT:
EXP NO: 8
DISCRETE FOURIER TRANSFORM
AIM
1.Find the DFT of a sequence x(n) =1, for 0n2 and 0 otherwise for N=4 and N=8. Plot
magnitude and phase plots for each.
2. Find the circular convolution of two finite duration sequences x1(n)=[1 -1 -2 3 -1] and x2(n) =
[1 2 3]
THEORY
Discrete fourier transform is found using the function fft(x,-1) and inverse discrete fourier
transform using fft(x,1). To plot the magnitude and phase response, magnitude is found using the
function abs(x) and phase using the function atan(imag(x),real(x)) .To find circular convolution
of two signals x1(n) and x2(n) their corresponding dfts are found and multiplied to get Y(K)=
X1(K)*X2(K). IDFT of Y(K) gives y(n). To find circular convolution of two sequences both the
sequences must be of same length and if not zeros are added to smallest sequence.
PROGRAM
// DFT magnitude and phase plot//
clc;
clear all;
close;
x1=[1 1 1 0];
X1=fft(x1,-1);
disp(X1,"X1(k) =");
x2=[1 1 1 0 0 0 0 0];
X2=fft(x2,-1);
disp(X2,"X2(k) =");
y1=abs(X1);
disp(y1);
n=0:1:3;
subplot(2,2,1)
plot2d3(n,y1);
y2=atan ( imag (X1),real (X1));
disp(y2);
subplot(2,2,2)
plot2d3(n,y2);
z1=abs(X2);
disp(z1);
m=0:1:7;
subplot(2,2,3)
plot2d3(m,z1);
z2=atan ( imag (X2),real (X2));
disp(z2);
subplot(2,2,4)
plot2d3(m,z2);
// Circular Convolution//
clear all;
clc ;
close ;
x1 =[1 , -1 , -2 ,3 , -1];
x2 =[1 ,2 ,3];
n1= length (x1);
n2= length (x2);
n3=n2 -n1;
if (n3>=0)
x1=[x1,zeros(1,n3)];
disp(x1);
else
x2=[x2,zeros(1,-n3)];
disp(x2);
end
//DFT Computation
X1=fft(x1 , -1);
X2=fft(x2 , -1);
Y=X1 .* X2;
//IDFT Computation
y= fft (Y ,1) ;
// Di s pl a y s e quenc e y [ n ] i n command window
disp (y,"y [ n]=");
EXP NO: 9
log s
p
s
c
in H(s).
cosh 1 s
p
a=
1
N
1
N
1
N
1
N
[ ]
[ + ]
p b=
p
2
2
Where
= 1 + 2 +1
= 10 0.1 1
p
1+ 2
PROGRAM
// BUTTERWORTH HIGH PASS FILTER//
clc;
clear all;
clf;
ap=2;
as=10;
Wp=20;
Ws=30;
k1=sqrt(((10^(0.1*as))-1)/((10^(0.1*ap))-1));
k2=Ws/Wp;
n=log(k1)/log(k2);
disp(n);
N=ceil(n);
disp(N);
for(i=1:N)
ph(i)=%pi/2+((2*i-1)*(%pi)/(2*N));
p(i)=cos(ph(i))+%i*sin(ph(i));
//disp(ph(i));
//disp(p(i));
end
//denominator H(s)
s=%s;
H1=1;
fori=1:N
H1=H1*(s-p(i));
//disp(H1);
end
H=1/H1;
Wc=Wp/((((10^(0.1*ap))-1))^(1/(2*N)));
disp(Wc);
H2=horner(H,s/Wc);
disp(H2,'H(s)=');
// CHEBYSHEV LOW PASS FILTER//
clc;
clear all;
clf;
F=1;
ap=1;
as=15;
wp=(0.2*%pi);
ws=(0.3*%pi);
disp(wp);
disp(ws);
T=(1/F);
Wp=(2/T)*tan(wp/2);
Ws=(2/T)*tan(ws/2);
disp(Wp);
disp(Ws);
k1=sqrt(((10^(0.1*as))-1)/((10^(0.1*ap))-1));
k2=Ws/Wp;
n=acosh(k1)/acosh(k2);
//disp(n);
N=ceil(n);
disp(N);
e=sqrt((10^(0.1*ap))-1);
disp(e);
u=1/e+sqrt(1+(e^-2));
disp(u);
a=Wp*((u^(1/N)-u^(-1/N))/2);
disp(a);
b=Wp*((u^(1/N)+u^(-1/N))/2);
disp(b);
for(i=1:N)
ph(i)=%pi/2+((2*i-1)*(%pi)/(2*N));
p(i)=a*cos(ph(i))+%i*b*sin(ph(i));
//disp(ph(i));
//disp(p(i));
end
//denominator H(s)
s=%s;
H1=1;
fori=1:N
H1=H1*(s-p(i));
end
disp(H1);
//numerator H(s)
i=modulo(N,2);
disp(i);
if(i==0)
H2=(horner(H1,0))/(sqrt(1+(e^2)));
else
H2=horner(H1,0);
end
disp(H2);
H=H2/H1;
disp(H,'H(s)=');
//bilinear transformation
z=%z;
Hz=(2/T)*(horner(H,(z-1)/(z+1)));
disp(Hz,'H(z)=');
EXP NO: 10
w 2
Hd(e ) = 1, 2
jw
= 0,
2 |w|
2. Design a ideal high pass filter with a frequency response for N= 11 and plot the
magnitude response . Repeat the same using a hanning window
Hd(ejw) = 1,
|w|
= 0, |w|
THEORY
The fourier series method of designing FIR filter is used in implementing FIR filter
using scilab. To get the FIR filter function the series of infinite duration obtained is truncated by
N 1
assigning h(n) = hd(n) for |n|
2
desiried sequence. But abrupt truncation of fourier series results in oscillation in the pass band
and stop band. To reduce these oscillations the fourier coefficients of the filter are modified by
multiplying with a finite sequence w(n) called window
w(n) =w(-n) 0 for |n|
N 1
2
PROGRAM
// FIR low pass filter//
clear all;
clc ;
close ;
N =11;
U =6;
for n= -5+U :1:5+ U
if n ==6
hd(n) =0.5;
else
hd(n)=( sin (%pi *(n-U) /2) )/( %pi *(n-U));
end
end
[ hzm ,fr ]= frmag (hd ,256) ;
hzm_dB = 20* log10 (hzm)./ max ( hzm );
figure ;
plot (2* fr , hzm_dB );
a= gca ();
clc ;
close ;
N =11;
U =6;
h_hann=window('hn',N);
for n= -5+U :1:5+ U
if n ==6
hd(n) =0.75;
else
hd(n)=( sin ( %pi *(n-U))-sin( %pi *(n-U)/4))/( %pi *(n-U));
end
h(n)= h_hann (n)*hd(n);
disp(h(n));
end
[ hzm ,fr ]= frmag (h ,256) ;
hzm_dB = 20* log10 (hzm)./ max ( hzm );
figure
plot (2* fr , hzm_dB )
a= gca ();
xlabel ( ' Frequency w' );
ylabel ( 'Magnitude in dB ' );
title ( ' Frequency Response of FIR HRF with N=11 usin g Hanning Window ' );
xgrid (2);
EXP NO : 11
BASIC EXPERIMENTS USING DSP KIT
AIM
1. Study of digital signal processor kit TMS320C6748/ OMAPL138
2. Implementation of simple programs using TMS320C678
Sinewave generation
Linear Convolution
Discrete Fourier Transform
THEORY
The TMS320C6748 DSP development kit (LCDK) is a scalable platform that breaks
down development barriers for applications that require embedded analytics and real-time signal
processing, including biometric analytics, communications and audio. The low-cost LCDK will
also speed and ease your hardware development of real-time DSP applications. This new board
reduces design work with freely downloadable and duplicable board schematics and design files.
A wide variety of standard interfaces for connectivity and storage enable you to easily bring
audio, video and other signals onto the board.The LCDK does not have an onboard emulator. An
external emulator from TI (such as the XDS100, XDS200,XDS510, XDS560) or a third-party
will be required to start development
TMS320C6748 DSP Features
Highest-Performance Floating-Point Digital Signal Processor (DSP):
Eight 32-Bit Instructions/Cycle
Up to 16 transmit pins
PROCEDURE
1
2
3
To plot graph go to Tools Graph Single Time and set the graph properties
according to the program.
PROGRAM
1. SINE WAVE GENERATION
#include <stdio.h>
#include<math.h>
#define FREQ 1
float m[100];
void main()
{
int i=0;
for(i=0;i<99;i++)
{
m[i]=sin(2*3.14*FREQ*i/100);
printf("%f\n",m[i]);
}
}
2. LINEAR CONVOLUTION
#include<stdio.h>
#define LENGTH1 6 /*Length of i/p samples sequence*/
#define LENGTH2 4 /*Length of impulse response Co-efficient */
int x[LENGTH1+LENGTH2-1]={1,2,3,4,5,6,0,0,0,0,0}; /*Input Signal Samples*/
int h[LENGTH1+LENGTH2-1]={1,2,3,4,0,0,0,0,0,0,0}; /*Impulse Response Coefficients*/
int y[LENGTH1+LENGTH2-1];
main()
{
int i=0,j;
for(i=0;i<(LENGTH1+LENGTH2-1);i++)
{
y[i]=0;
for(j=0;j<=i;j++)
y[i]+=x[j]*h[i-j];
}
for(i=0;i<(LENGTH1+LENGTH2-1);i++)
printf("%d\n",y[i]);
}
sumim=0;
for(n=0;n<N;n++)
{
sumre=sumre+x[n]* cos(2*pi*k*n/N);
sumim=sumim-x[n]* sin(2*pi*k*n/N);
}
out_real[k]=sumre;
out_imag[k]=sumim;
printf("X([%d])=\t%f\t+\t%fi\n",k,out_real[k],out_imag[k]);
}
}
RESULT AND DISCUSSION:
DSP kit was familiarized and basic operations were performed using it.