Lab Manual-1
Lab Manual-1
OBJECTIVES: 0042
The student should be made:
To visualize the effects of sampling and TDM
To Implement AM & FM modulation and demodulation
To implement PCM & DM
To simulate Digital Modulation schemes
To simulate Error control coding schemes
LIST OF EXPERIMENTS:
1. Signal Sampling and reconstruction
12. Simulation of Linear Block and Cyclic error control coding schemes
TOTAL: 60 PERIODS
OUTCOMES:
At the end of the course, the student should be able to:
Simulate & validate the various functional modules of a communication system
Demonstrate their knowledge in base band signalling schemes through
implementation of digital modulation schemes
Apply various channel coding schemes & demonstrate their capabilities
towards the improvement of the noise performance of communication system
Simulate end-to-end communication Link
S.No. List of Experiments Page no.
1. Signal Sampling
2. Signal Sampling and reconstruction
3. Amplitude modulation
4. AM Modulator and Demodulator
5. FM Modulator and Demodulator
6. Time Division Multiplexing
7. Pulse Code Modulation and Demodulation
8. Delta Modulation and Demodulation
9. Line coding schemes
10. Simulation of ASK, FSK, and BPSK generation
schemes
11. Simulation of DPSK, QPSK and QAM generation
schemes
12. Simulation of signal constellations of BPSK, QPSK
and QAM
13. Simulation of ASK, FSK and BPSK detection
schemes
14. Simulation of Linear Block and Cyclic error control
coding schemes
15. Simulation of Convolutional coding scheme
16. Communication link simulation
EX.No.1
SIGNAL SAMPLING
Aim:
To construct the sampling circuit and verify its result.
Apparatus required:
NAME OF THE EQUIPMENT /
S.NO. RANGE QUANTITY
COMPONENT
1. Transistor BC 107 1
2. Resistor 10k 3
3. Function Generators - 2
4. CRO - 1
5. Bread board - 1
6. Regulated Power supply 0-30V 1
7. Connecting wires - As required
Theory:
The analog signal can be converted to a discrete time signal by a process called
sampling. The sampling theorem for a low pass signal can be stated as,
“A band limited signal of finite energy, which has no frequency component higher than W
Hz is completely described by specifying the values of the signal at instants of time
separatedby1/2Wseconds.Itcanberecoveredfromknowledgeofsamplestakenatthe rate of 2W
persecond.”
Sampling is the process of splitting the given analog signal into different samples of equal
amplitudes with respect to time. There are two types of sampling namely natural sampling,
flat top sampling. Sampling should follow strictly the Nyquist Criterion i.e. the sampling
frequency should be twice higher than that of the highest frequency signal.
fs 2 fm
Where,
fs Minimum Nyquist Sampling rate (Hz)
fmMaximum analog input frequency (Hz).
Circuit Diagram:
Model Graph:
Tabualtion:
Message signal
Carrier Signal
Sampled Signal
Ex.No. 2 SIGNAL SAMPLING AND ITS RECONSTRUCTION
AIM:
APPARATUS REQUIRED:
3. Power supply 1
THEORY:
The sampling is achieved by an electronic switch that turns ON and OFF at the
different sampling rates and the samples of the analog signals is being transmitted during
the sampling times.
PROCEDURE:
1. Connect the 2 KHz 5V p-p signal generated onboard to the analog input by means of
patch cords provided.
2. Connect the sampling frequency signal in the internal mode, by means of the shorting
pin provided.
3. By varying the carrier signal with different frequencies (2, 4, 8, 16, 32 KHz), observe
the effect of sampling.
4. Take the amplitude and time period of sampled, sample and hold output.
5. Connect the Sample and hold output to the input of the 2/4 th order of LPF.
Model Graph:
Tabualtion:
Message signal
Carrier Signal
Sampled Signal
Reconstructed signal
Result:
Thus the sampling process was verified and the readings were plotted.
Ex. No. 3 AMPLITUDE MODULATION AND DEMODULATION
AIM:
APPARATUS REQUIRED:
3. Power supply 1
THEORY:
The process of changing the amplitude of a carrier signal in proportion with the
instantaneous value of the modulating signal is called amplitude modulation (AM). In AM,
the carrier frequency should be relatively higher than the modulating frequency. This type
of modulation is generally used in commercial broadcasting of both video and audio
information. It also finds applications in two-way mobile radio communications such as in
Citizen’s Band radio. AM modulators are non-linear devices having two inputs and one
output. One of the inputs is the high frequency carrier and the other is the low-frequency
information signal, which can be of a single frequency or a band of frequencies as in the
case of speech signals. In general, the modulation index m is given by
𝑽𝒎
𝑴𝒐𝒅𝒖𝒍𝒂𝒕𝒊𝒐𝒏 𝒊𝒏𝒅𝒆𝒙, 𝒎 =
𝑽𝒄
PROCEDURE:
Modulation:
Demodulation:
MODEL GRAPH:
TABULATION:
Message signal
Carrier Signal
AM modulated Wave
Demodulated signal
RESULT:
Ex. No. 4 FREQUENCY MODULATION AND DEMODULATION
AIM:
APPARATUS REQUIRED:
3. Power supply 1
THEORY:
PROCEDURE:
Modulation:
Connect the patch cord S01 AF output to Modulating signal input S02.
Connect ground SG1 to Ground SG2.
Vary the modulation POT.
Observe the FM output on S04 or TP4.
Demodulation:
TABULATION:
Message signal
Carrier Signal
FM modulated Wave
Demodulated signal
RESULT:
Ex. No. 5 TIME DIVISON MULTIPLEXING
AIM:
APPARATUS REQUIRED:
3. Power supply 1
THEORY:
PROCEDURE:
Multiplexing:
Connect the 4 channel inputs of 250Hz, 500Hz, 1 KHz, 2 KHz to the Multiplexer
inputs CH0, CH1, CH2 and CH3 respectively.
Observe the time division multiplexed PAM waveform at the output of the
Multiplexer.
Observe the four different signals placed in their respective time slots.
Vary each of the amplitude of each channel and see the effect on the TDM waveform.
Demultiplexing:
Connect the TXCLOCK (Transmitter clock) to RXCLOCK (Receiver clock).
Connect TXCH) (Transmitter sync) to RXCH0 (Receiver sync).
Connect the TXD (transmitter data) to RXD (Receiver Data).
Observe the demultiplexed signals at the receiver across the output of fourth order LPF
at CH0, CH1, CH2 and CH3 respectively.
MODEL GRAPH:
TABULATION:
Message signal 1
Message signal 2
Message signal 3
Message signal 4
Multiplexed Signal
Reconstructed signal 1
Reconstructed signal 2
Reconstructed signal 3
Reconstructed signal 4
RESULT:
Ex. No. 6 PULSE CODE MODULATION AND DEMODULATION
AIM:
APPARATUS REQUIRED:
4. Power supply 1
THEORY:
Transmitter:
Connect 500 Hz to CH0 and 1 KHz to CH1.
Set the speed selection switch to FAST mode.
Observe the PCM output in TP48.
Receiver:
Connect the PCM OUTPUT (TP48) from transmitter kit to RX data In Receiver kit
using BS2 patch cord.
Connect TXCLOCK from transmitter kit to RXCLOCK in receiver kit.
Connect TXSYNC from transmitter kit to RXSYNC in receiver kit.
Observe the Reconstructed output at TP 43 and TP 44 for the respective channel
inputs. And Compare it with the inputs at transmitter kit.
RESULT:
Ex. No. 7 DELTA MODULATION AND DEMODULATION
AIM:
APPARATUS REQUIRED:
3. Power supply 1
THEORY:
In the Differential Pulse Code Modulation (DPCM) process, when the sampling
interval is reduced, the sample-to-sample amplitude difference becomes small, like the
difference is of 1-bit quantization. Hence the step-size will be very small.
Delta modulation is a process mainly used in the transmission of voice information.
It is a technique where analog-to-digital and digital-to-analog signal conversion is seen.
Delta modulation (DM) is an easy way of DPCM. In this technique, the difference between
consecutive signal samples is encoded into n-bit data streams. In DM, the data which is to
be transmitted is minimized to a 1-bit data stream.
PROCEDURE:
1. Connect PLA1 to PLAA.
2. Connect channel m1 to CRO to TPA1/TPAA; adjust VR1 to minimum to get zero level
signals.
3. Connect channel 1 to TP1 to channel 2 to TPB1 and adjust VR2 to obtain square wave
half the frequency of the clock rate selected (output at TP1).
4. Connect channel 1 to TP2 and set voltage /div of channel 1 to mV range and observe a
triangle waveform, which is output of integrator. It can be observed that is the clock rate
is increased, amplitude of triangle waveform decreases. This is called minimum step
size.(clock rate can be changed by depressing SW1 switch).
5. Connect channel 1 to TPA1, TPAA; adjust VR1 in order to obtain a 1KHz sine wave of
500 mVpp approximately.
6. Signal approximating 1 KHz is available at the integrator output (TP2); this signal is
obtained by integrating the digital output resulting from delta modulation.
7. Connect channel 1 to TP2 and channel 2 to TPB1; it can be observed that the digital
high makes the integrator output to go upwards and digital low makes the integrator
output to go downwards.
8. With an oscilloscope displaying three traces, it is possible to simultaneously observe the
input signal of the modulation, the digital output of the modulator and the signal
obtained by the integration from the modulator digital output.
Notice that, when the output (feedback signal) is lower that the analog input the
digital output is high, whenever it is low when the analog input is lower that the
integrated output.
9. Increase the amplitude of 1 KHz sine wave by rotating VR1 to Vpp and observe that the
integrator output follows the input signal.
10. Increase the amplitude of 1 KHz sine wave further high, and observe that the integrator
output cannot follow the input signal.
11. Repeat the above-mentioned procedures with different signal sources and selecting
different clock rates and observe the response of the linear delta modulator.
MODEL GRAPH:
TABULATION:
Message signal
Integrator output
Demodulated signal
RESULT:
Ex. No. 8 LINE CODING SCHEMES
AIM:
APPARATUS REQUIRED:
3. Power supply 1
THEORY:
It is required to represent an analog data in binary symbols 0 and 1. The most
commonly used PCM popular data formats are being realized here.
This waveform is extensively used in magnetic tape recording. In this data format,
all one’s are marked by change in levels and all zero’s by no transitions., and the
transitions take place at the rising edge of the clock.
1 0 1 1 0 0 0 1 1 0 1
+v
-v NRZ -L
+v NRZ -M
-v
c.Non-return to zero – SPACE coding (NRZ-S ):
This type of waveform is marked by change in levels for ‘zeros’ and no transition of
for ‘ones’ and the transition take place at the rising edge of the clock. This format is
also used in magnetic tape recording
1 0 1 1 0 0 0 1 1 0 1
+v
-v NRZ - L
+v NRZ -S
-v
.
2) RETURN TO ZERO SIGNALS:
These signals are called “Return to zero signals”, since they return to ‘zero’ with the
clock. In this category, only one data format, i.e., the unipolar return to zero (URZ).
This code is unipolar as excursion is between 0V and +V. But logic 1 here is
represented by a pulse which returns to zero (RZ) after a brief period (usually half
bit period) within bit interval. With the URZ, a ‘one’ is represented by a half bit
wide pulse and a ‘zero’ is represented by the absence of a pulse.
1 0 1 1 0 0 0 1 1 0 1
+v NRZ -L
-v
+v
URZ
0v
1 0 1 1 0 0 0 1 1 0 1
+v
-v NRZ - L
+v
-v Bi-phase - L
+v 1 0 1 1 0 0 0 1 1 0 1
NRZ -L
-v
+v
Bi-phase - M
-v
+v 1 0 1 1 0 0 0 1 1 0 1
NRZ - L
-v
+v
Bi-phase - S
-v
4 ) Return to zero – Alternate Mark Inversion Coding (RZ-AMI):
This coding scheme is most often used in telemetry systems. This scheme comes under both
the category of return to zero scheme and multilevel scheme. The one’s are represented by
pulse width of half the bit duration existing in the alternate direction whereas zero’s are
represented by absence of the pulse.
PROCEDURE:
subplot(4,1,3);
plot(t,ask_sig(i,:));
title('ask signal'); hold on
xlabel('t--->');ylabel('s(t)');
subplot(4,1,4);stem(demod);
title('ask demodulated signal');xlabel('--->');ylabel('d(t)');
end
hold off
OUTPUT:
else
msg=-1*ones(1,length(t));
end
% modulation
psk_sig(i,:)=c.*msg;
% Demodulation
x=sum(c.*psk_sig(i,:));
if x>0
demod(i)=1;
else
demod(i)=0;
end
Subplot(4,1,3);
plot(t,psk_sig(i,:));
xlabel('t-->');
ylabel('S(t)');
grid on
hold on
Subplot(4,1,4);
stem(demod);
xlabel('t-->');
ylabel('m^t)');
end
hold off
Output:
stem(m);
title('Message signal');
xlabel('n-->');
ylabel('m(n)');
Subplot(5,1,2);
plot(t,c1);
t1=0; t2=tb;
for i= 1:N
t=[t1:(tb/100):t2];
if m(i)==1;
msg=ones(1,length(t));
inv_msg= zeros(1,length(t));
else
msg=zeros(1,length(t));
inv_msg= ones(1,length(t));
end
% modulation
fsk_sig1(i,:)=c1.*msg;
fsk_sig2(i,:)=c2.*inv_msg;
fsk=fsk_sig1+fsk_sig2;
% Demodulation
x1=sum(c1.*fsk_sig1(i,:));
x2=sum(c2.*fsk_sig2(i,:));
x=x1-x2;
if x>0
demod(i)=1;
else
demod(i)=0;
end
Subplot(5,1,4);
plot(t,fsk(i,:));
xlabel('t-->');
ylabel('S(t)');
grid on
hold on
Subplot(5,1,5);
stem(demod);
xlabel('t-->');
ylabel('m^t)');
end
hold off
Output:
Program:
Tb=1;t=0:(Tb/100):Tb;fc=2;
c1=sqrt(2/Tb)*cos(2*pi*fc*t);
c2=sqrt(2/Tb)*sin(2*pi*fc*t);
N=10;m=[1 1 1 0 0 1 0 0 0 1 ];
t1=0;t2=Tb
for i=1:2:(N-1)
t=[t1:(Tb/100):t2]
if m(i)>0.5
m(i)=1;
m_s=ones(1,length(t));
else
m(i)=0;
m_s=-1*ones(1,length(t));
end
odd_sig(i,:)=c1.*m_s;
if m(i+1)>0.5
m(i+1)=1;
m_s=ones(1,length(t));
else
m(i+1)=0;
m_s=-1*ones(1,length(t));
end even_sig(i,:)=c2.*m_s;
qpsk=odd_sig+even_sig;
subplot(3,2,4);plot(t,qpsk(i,:));
title('QPSK');
t1=t1+(Tb+0.01);t2=t2+(Tb+0.01);
end
hold off
subplot(3,2,1);stem(m);
grid on;
subplot(3,2,2);
plot(t,c2);
grid on;
subplot(3,2,3);plot(t,c2);
title('carrier signal2');
xlabel('t--->');
ylabel('c2(t)');
grid on;t1=0;t2=Tb
for i=1:N-1
t=[t1:(Tb/100):t2]
x1=sum(c1.*qpsk(i,:));
x2=sum(c2.*qpsk(i,:));
if (x1>0&&x2>0)
demod(i)=1;
demod(i+1)=1;
elseif(x1>0&&x2<0)
demod(i)=1;
demod(i+1)=0;
elseif(x1<0&&x2<0)
demod(i)=0;
demod(i+1)=0;
elseif(x1<0&&x2>0)
demod(i)=0;
demod(i+1)=1;
end
t1=t1+(Tb+0.01);
t2=t2+(Tb+0.01);
end subplot(3,2,5);
stem(demod);
title('QPSK demod');
xlabel('n--->');
ylabel('b(n)');
grid on;
Signal constellation of BPSK,QPSK and QAM
BPSK:
clearall;
closeall;
clc; M=2;
x=randint(1000,1,M);
y1=pskmod(x,M);
y1n=awgn(y1,10,'measured');
scatterplot(y1n);
y1r=pskdemod(y1n,M);
[num_error,er_rate]=symerr(x,y1r)
OUTPUT:
QAM:
clear all;
close all;
clc;
M=16;
x=randint(1000,1,M);
y1=qammod(x,M);
y1n=awgn(y1,10,'measured');
scatterplot(y1n);
y1r=qamdemod(y1n,M);
[num_error,er_rate]=symerr(x,y1r)
OUTPUT:
QPSK: Clear
all; Close all;
clc;
b=2;
M=2^b;
ss=[0 0; 0 1; 1 1; 1 0;];
Tb=1;
Ts=b*Tb;
Nb=32;
Ns=b*Nb;
T=Ts/Ns;
LB=4*Ns;
LBN1=LB-Ns+1;
Es=2; sqEs=sqrt(Es);
wc=8*pi/Ts; t=[0:Ns-
1]*T; wcT=wc*T;
phases=2*pi/M*[0:M-1];
gs='>^<vs*x+d';
nd=0;
end
su=sqrt(2/Ts)*[cos(wc*t); -sin(wc*t)];
suT=su*T; SNRdBs=[1:10];
MaxIter=10000;
foriter=1:length(SNRdBs)
SNRbdB=SNRdBs(iter);
SNR=10^(SNRbdB/10);
N0=2*(Es/b)/SNR;
sigma2=N0/2;
sgmsT=sqrt(sigma2/T);
sws=zeros(1,LB);
yr=zeros(2,LB); nobe=0;
for k=1:MaxIter
i=ceil(rand*M);
s=ss(i,:);
for n=1:Ns sws=[sws(2:LB)
sw(i,n)]; wct=wcT*(n-1);
bp_noise=randn*cos(wct)-randn*sin(wct);
rn=sws(end-nd)+sgmsT*bp_noise;
yr=[yr(:,2:LB) suT(:,n)*rn];
end
ycsk=sum(yr(:,LBN1:LB)')';
ifiter==9&k<300
end
th=atan2(ycsk(2),ycsk(1));
ifth<-pi/M, th=th+2*pi;
end
[themin,lmin]=min(abs(th-phases));
d=ss(lmin,:);
nobe=nobe+sum(s~=d);
ifnobe>100, break; end
end
pobe(iter)=nobe/(k*b);
end
plot(sqEs*exp(j*phases)+j*eps,'ro')
SNRbdBt=0:0.1:10;
SNRbt=10.^(SNRbdBt/10);
pobet=(1+(b>1))/b*erfc(sqrt(b*SNRbt)*sin(pi/M));
subplot(222);
semilogy(SNRbdBt,pobet,'k-',SNRdBs,pobe,'b*')
2
-2
10
-4
10
-2
-6
-4 10
-4 -2 0 2 4 0 5 10
ERROR CONTROL CODES
clc;
clear all;
close all;
disp ('The Order of Linear block Code for given Generator Matrix is:')
[n,k] = size(transpose(g))
for i = 1:2^k
for j = k:-1:1
if rem(i-1,2^(-j+k+1))>=2^(-j+k)
u(i,j)=1;
else
u(i,j)=0;
end
end
end
u;
c = rem(u*g,2)
disp('The Minimum Hamming Distance dmin for given Block Code is= ')
d_min = min(sum((c(2:2^k,:))'))
% Code Word
p = [g(:,n-k+2:n)];
h = [transpose(p),eye(n-k)];
disp('Hammimg Code')
ht = transpose(h)
for i = 1:1:size(ht)
if(ht(i,1:3)==s)
r(i) = 1-r(i);
break;
end
end
r
OUTPUT:
g=
1 1 1 1 0 0 0
0 1 0 0 1 0 0
0 1 1 0 0 1 0
1 0 1 0 0 0 1
G=
The Order of Linear block Code for given Generator Matrix is:
n=
k=
c=
0 0 0 0 0 0 0
1 0 1 0 0 0 1
0 1 1 0 0 1 0
1 1 0 0 0 1 1
0 1 0 0 1 0 0
1 1 1 0 1 0 1
0 0 1 0 1 1 0
1 0 0 0 1 1 1
1 1 1 1 0 0 0
0 1 0 1 0 0 1
1 0 0 1 0 1 0
0 0 1 1 0 1 1
1 0 1 1 1 0 0
0 0 0 1 1 0 1
1 1 0 1 1 1 0
0 1 1 1 1 1 1
The Minimum Hamming Distance dmin for given Block Code is=
d_min =
r =1 0 1 1 0 0 1
Hammimg Code
ht =
1 0 0
0
0 10 0
0 0 1
1 0 0
0 1 0
0 0 1
s=
0 1 0
i=
r=
1 0 0 1 0 0 1
% Cyclic Codes
clc;
clear all;
close all;
n=3, k=2;
input=randint(10,k,[0 1]);
disp('input'); disp (input);
code=encode(input,n,k,'cyclic|binary');
disp('encoded message');
disp (code);
error=randerr(10,n, [0 1; .6 .4]);
disp('error');
disp(error);
noise=rem(code+randerr(10,n,[0 1; .6 .4]),2);
disp('noise'); disp(noise);
output=decode(noise,n,k,'cyclic');
disp('output');
disp(output);
[numerr,ratio]=biterr(output,input);
disp(['The bit error rate is',num2str(ratio)]);
err_words=find(ratio~=0);
disp(err_words);
n=
3
1 0
input
1 1
0 1
1 1
0 0
1 0
1 1
1 1
0 0
1 0
encoded message
1 1 0
0 1 1
1 0 1
0 1 1
0 0 0
1 1 0
0 1 1
0 1 1
0 0 0
1 1 0
error
0 00 01
00 0 0
0 0 0
0 0 0
0 0 0
0 0 0
1 0 0
0 0 0
1 0 0
noise
0 11 10
11 1 1
0 1 0
0 0 1
1 1 0
0 0 1
1 1 1
0 0 0
1 0 0
output
1 0
1 1
1 1
1 0
0 1
1 0
0 1
1 1
0 0
0 0
1
Convolutional codes
clc;
clear all;
close all;
m=length(x);
n=length(h);
X=[x,zeros(1,n)];
H=[h,zeros(1,m)];
for i=1:n+m-1
y(i)=0
for j=1:m
if(i-j+1>0)
y(i)=y(i)+X(j)*H(i-j+1);
else
end
end
end
Output:
y=
1 1 1 1 1 1 1 1 0
Communication Link Simulation
Block Diagram:
Output: