Advanced Communication-Lab - Part B
Advanced Communication-Lab - Part B
Advanced Communication-Lab - Part B
Experiment no 1:
Aim:
Simulate NRZ, RZ, half-sinusoid and raised cosine pulses and generate eye diagram for binary polar
signaling.
Theory:
Unipolar nonreturn-to-zero (NRZ) signaling:
In this line code, symbol 1 is represented by transmitting a pulse A for the duration of the symbol,
and symbol 0 is represented by switching off the pulse, as in Figure (1.a).This line code is also
referred to as on-off signaling. Disadvantages of on-off signaling are the waste of power due to
transmitted DC level and the fact that the power spectrum of the transmitted signal does not
approach zero at zero frequency
Figure 1.
% (prcos.m)
function y=prcos(rollfac,length, T)
% rollfac = 0 to 1 is the rolloff factor
% length is the onesided pulse length in the number of T
% length = 2T+1;
% T is the oversampling rate
y=rcosfir(rollfac, length, T,1, ’normal’);
% -------------------------------------------------------------
% (binary_eye.m)
% generate and plot eyediagrams
data = sign(randn(1,400));% Generate 400 random bits
dataup=upsample(data, Tau); % Generate impulse train
ynrz=conv(dataup,pnrz(Tau)); % Non-return to zero polar
yrcos=conv(dataup,prcos(0.5,Td,Tau)); % rolloff factor = 0.5
yrcos=yrcos(2*Td*Tau:end-2*Td*Tau+1); % generating RC pulse train
eye1=eyediagram(yrz,2*Tau,Tau,Tau/2);title(’RZ eye-diagram’);
eye2=eyediagram(ynrz,2*Tau,Tau,Tau/2);title(’NRZ eye-diagram’);
eye3=eyediagram(ysine,2*Tau,Tau,Tau/2);title(’Half-sine eye-diagram’);
eye4=eyediagram(yrcos,2*Tau,Tau); title(’Raised-cosine eye-diagram’);
Experiment no 2:
Aim: Simulate the Pulse code modulation and demodulation system and display the waveforms.
Block diagram:
PCM Modulator:
PCM Demodulator:
Theory:
Modulation is the process of varying one or more parameters of a carrier signal in accordance with the
instantaneous values of the message signal. The message signal is the signal which is being transmitted
for communication and the carrier signal is a high frequency signal which has no data, but is used for
long distance transmission. There are many modulation techniques, which are classified according to
the type of modulation employed. Of them all, the digital modulation technique used is Pulse Code
Modulation (PCM).
A signal is pulse code modulated to convert its analog information into a binary sequence,
i.e., 1s and 0s. The output of a PCM will resemble a binary sequence. The following figure shows an
example of PCM output with respect to instantaneous values of a given sine wave.
Instead of a pulse train, PCM produces a series of numbers or digits, and hence this process is called
as digital. Each one of these digits, though in binary code, represent the approximate amplitude of the
signal sample at that instant.
In Pulse Code Modulation, the message signal is represented by a sequence of coded pulses. This
message signal is achieved by representing the signal in discrete form in both time and amplitude.
Basic Elements of PCM
The transmitter section of a Pulse Code Modulator circuit consists of Sampling,
Quantizing and Encoding, which are performed in the analog-to-digital converter section. The low pass
filter prior to sampling prevents aliasing of the message signal.
The basic operations in the receiver section are regeneration of impaired signals,
decoding, and reconstruction of the quantized pulse train. Following is the block diagram of PCM
which represents the basic elements of both the transmitter and the receiver sections.
This filter eliminates the high frequency components present in the input analog signal which is greater
than the highest frequency of the message signal, to avoid aliasing of the message signal.
Sampler
This is the technique which helps to collect the sample data at instantaneous values of message signal,
so as to reconstruct the original signal. The sampling rate must be greater than twice the highest
frequency component Wof the message signal, in accordance with the sampling theorem.
Quantizer
Quantizing is a process of reducing the excessive bits and confining the data. The sampled output when
given to Quantizer, reduces the redundant bits and compresses the value.
Encoder
The digitization of analog signal is done by the encoder. It designates each quantized level by a binary
code. The sampling done here is the sample-and-hold process. These three sections (LPF, Sampler, and
Quantizer) will act as an analog to digital converter. Encoding minimizes the bandwidth used.
Regenerative Repeater
This section increases the signal strength. The output of the channel also has one regenerative repeater
circuit, to compensate the signal loss and reconstruct the signal, and also to increase its strength.
Decoder
The decoder circuit decodes the pulse coded waveform to reproduce the original signal. This circuit
acts as the demodulator.
Reconstruction Filter
After the digital-to-analog conversion is done by the regenerative circuit and the decoder, a low-pass
filter is employed, called as the reconstruction filter to get back the original signal.
Hence, the Pulse Code Modulator circuit digitizes the given analog signal, codes it and samples it, and
then transmits it in an analog form. This whole process is repeated in a reverse pattern to obtain the
original signal.
Algorithm:
Program:
clc;
close all;
clear all;
n=input('Enter n value for n-bit PCM system : ');
n1=input('Enter number of samples in a period : ');
L=2^n;
% % Signal Generation
% x=0:1/100:4*pi;
Dept. of ECE, VSMSRKIT, Nipani Page 41
Advanced Communication LAB Manual 15ECL76
% Quantization Process
vmax=8;
vmin=-vmax;
del=(vmax-vmin)/L;
part=vmin:del:vmax; % level are between vmin and vmax with difference of del
code=vmin-(del/2):del:vmax+(del/2); % Contaion Quantized valuses
[ind,q]=quantiz(s,part,code); % Quantization process
% ind contain index number and q contain quantized values
l1=length(ind);
l2=length(q);
for i=1:l1
if(ind(i)~=0) % To make index as binary decimal so started from 0 to N
ind(i)=ind(i)-1;
end
i=i+1;
end
for i=1:l2
if(q(i)==vmin-(del/2)) % To make quantize value inbetween the levels
q(i)=vmin+(del/2);
end
end
subplot(3,1,3);
stem(q);grid on; % Display the Quantize values
title('Quantized Signal');
ylabel('Amplitude--->');
xlabel('Time--->');
% Encoding Process
figure
code=de2bi(ind,'left-msb'); % Cnvert the decimal to binary
k=1;
for i=1:l1
for j=1:n
coded(k)=code(i,j); % convert code matrix to a coded row vector
j=j+1;
k=k+1;
end
i=i+1;
end
subplot(2,1,1); grid on;
stairs(coded); % Display the encoded signal
axis([0 100 -2 3]); title('Encoded Signal');
ylabel('Amplitude--->');
xlabel('Time--->');
qunt=reshape(coded,n,length(coded)/n);
index=bi2de(qunt','left-msb'); % Getback the index in decimal form
q=del*index+vmin+(del/2); % getback Quantized values
subplot(2,1,2); grid on;
plot(q); % Plot Demodulated signal
title('Demodulated Signal');
ylabel('Amplitude--->');
xlabel('Time--->');
Model Graphs:
Results:
Conclusion:
Experiment No.3
QUADRATURE PHASE SHIFT KEYING
Aim: To generate and demodulate quadrature phase shifted (QPSK) signal using MATLAB
Theory
Generation of Quadrature phase shift keyed (QPSK) signal
QPSK is also known as quaternary PSK, quadriphase PSK, 4-PSK, or 4-QAM. It is a phase
modulation technique that transmits two bits in four modulation states.
Phase of the carrier takes on one of four equally spaced values such as π/4, 3π/4, 5π/4 and7π/4.
Si(t) = √2E/T cos {2 πƒct + (2i – 1) π/4} , 0≤ t ≤T
0 , elsewhere
Where i = 1,2,3,4, & E= Tx signal energy per symbol
T= symbol duration
Each of the possible value of phase corresponds to a pair of bits called dibits.
Thus the gray encoded set of dibits: 10,00,01,11
Si (t) = √2E/Tcos [(2i – 1)π/4] cos (2πfct) - √2E/Tsin [(2i –1) π/4)] sin (2πfct) ,0≤ t ≤Tb
0 , else where
There are two orthononormal basis functions
c1 (t) = √2/T cos 2πƒct, 0≤ t ≤Tb
c2 (t) = √2/T sin 2πƒct, 0≤ t ≤Tb
There are four message points
The I/p binary sequence b(t) is represented in polar from with symbols 1 & 0 represented as +√E/2 and -
√E/2. This binary wave is demutiplexed into two separate binary waves consisting of odd & even
numbered I/P bits denoted by b1 (t) & b2 (t). b1 (t) & b2(t) are used to modulate a pair of quadrature
carrier. The result is two PSK waves .These two binary PSK waves are added to produce the desired QPSK
signal
QPSK Receiver:
QPSK receiver consists of a pair of correlators with common I/P & supplied with locally generated signal
c1 (t) & c2 (t). The correlator output, x1, & x2 are each compared with a threshold of zero volts.If x1 > 0,
decision is made in favour of symbol ‘1’ for upper channel and if x1 > 0, decision is made in favour of
symbol 0. Parallely if x2 >0, decision is made in favour of symbol 1 for lower channel & if x2 <0, decision
is made in favour of symbol 0. These two channels are combined in a multiplexer to get the original
binary output.
Algorithm
Initialization commands
QPSK modulation
1. Generate quadrature carriers.
2. Start FOR loop
3. Generate binary data, message signal(bipolar form)
4. Multiply carrier 1 with odd bits of message signal and carrier 2 with even bits of message signal
5. Perform addition of odd and even modulated signals to get the QPSK modulated signal
6. Plot QPSK modulated signal.
7. End FOR loop.
8. Plot the binary data and carriers.
QPSK demodulation
1. Start FOR loop
2. Perform correlation of QPSK modulated signal with quadrature carriers to get two decision variables
x1 and x2.
3. Make decision on x1 and x2 and multiplex to get demodulated binary data.
If x1>0and x2>0, choose ‘11’. If x1>0and x2<0, choose ‘10’. If x1<0and x2>0, choose ‘01. If
x1<0and x2<0, choose ‘00’.
End FOR loop
Dept. of ECE, VSMSRKIT, Nipani Page 46
Advanced Communication LAB Manual 15ECL76
Program
% QPSK Modulation
clc;
clear all;
close all;
%GENERATE QUADRATURE CARRIER SIGNAL
Tb=1;t=0:(Tb/100):Tb;fc=1;
c1=sqrt(2/Tb)*cos(2*pi*fc*t);
c2=sqrt(2/Tb)*sin(2*pi*fc*t);
%generate message signal
N=8;m=rand(1,N);
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 bits modulated signal
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 bits modulated signal
even_sig(i,:)=c2.*m_s;
%qpsk signal
qpsk=odd_sig+even_sig;
subplot(3,2,5);stem(demod);
title('qpsk demodulated bits');xlabel('n---->');ylabel('b(n)');grid on;
Model Graphs:
Experiment no 4:
Aim: To simulate bit error rate performance of DPSK modulation using Matlab.
Theory
DPSK involves 2 basic operations at the transmitter, differential encoding of the i/p binary wave and
phase shift keying, hence the name DPSK. To send symbol 0 we phase advance the current signal
waveform by 1800 and to send symbol 1 we leave the phase of the current signal unchanged.
In the differential encoding at the transmitter input starts with an arbitrary first bit serving as reference
and thereafter the sequence is generated using
dk-1' previous value of differentially encoded digit.
bk' i/p binary digit at time kTb.
dk-1 ,bk' logical inversion.
Assuming reference bit added to {dk} is a'1'. {dk} is thus generated and used to phase shift key a carrier
with phase angles 0 and ?.
Algorithm
Initialization commands
1. Generate the input data randomly
2. Implement differential encoding
3. Do BPSK modulation
4. Add AWGN noise
5. Calculate the no of bits in error
6. Plot the BER graph
Program
N = 10^4 % number of bits or symbols
rand('state',100); % initializing the rand() function
Model Graphs: