Digital Communication Lab Cycle-2 Name: Charitha T S SRN: PES2201800220 Class: ECE-6A

Download as pdf or txt
Download as pdf or txt
You are on page 1of 13

1

Digital Communication Lab


CYCLE-2
Name: CHARITHA T S
SRN: PES2201800220
Class: ECE-6A

SRN : PES2201800220
2

Theory :

Transmitting a symbol takes twice as long as a bit (Ts = 2·Tb) which


means that the bandwidth efficiency of QPSK is twice that of BPSK. Bit
error rate (BER) of a communication system is defined as the ratio of
number of error bits and total number of bits transmitted during a
specific period. With Binary Phase Shift Keying (BPSK), the binary digits 1
and 0 maybe represented by the analog
levels and respectively

with and ,

SRN : PES2201800220
3

Code :

clc;
clear all;
close all;
n = 10^7;
s = 2*(rand(1,n)>0.5)-1;
EbNo = [-4:2:10];
for i = 1:length(EbNo)
no = 10^(-EbNo(i)/10);
nvar = no/2;
w = randn(1,n)*sqrt(nvar);
x = s+w;
s_hat = 2*(x>0)-1;
nerr = sum((abs(s-s_hat))/2);
ber(i) = nerr/n;
pe(i) = (0.5)*erfc(sqrt(1/no));
end
semilogy(EbNo,ber,'-dk'); %simulated BER
hold on;
semilogy(EbNo,pe,'-m'); % theoritical BER
title('BER plot for BPSK');
xlabel('E_b / N_0 in dB');
ylabel('Probability of error');
no=10^(-2/10);
nvar=no/2;
w=randn(1,n)*sqrt(nvar);
x=s+w;
scatterplot(x); % for E_b / N_0 = 2 dB
title('Scatterplot');
xlabel('In-Phase');
ylabel('Quadrature');
xlim([-4 4])
ylim([-4 4])

SRN : PES2201800220
4

SRN : PES2201800220
5

Theory :

From the symbol error rate vs Eb/No plot, we know that for the same
value of SNR per bit (Eb/No), the symbol error rate for QPSK is double
that of BPSK; and the symbol error rate of 16QAM is double that of
4PAM. So, I think that the points should not overlap (should be offset by
around 0.3dB).

SRN : PES2201800220
6

Constellation plot for QPSK (4-QAM) constellation

Assuming that the additive noise follows the Gaussian probability


distribution function,

with and

Code :

clc;
clear all;
close all;
n = 10^7;
s = (2*(rand(1,n)>0.5)-1)+1j*(2*(rand(1,n)>0.5)-1);
EbNo = [-4:2:12];
for i = 1:length(EbNo)
no = 10^(-EbNo(i)/10);
nvar = no/2;
w = (randn(1,n)+1j*randn(1,n))*sqrt(nvar);
x = s+w;
xr=real(x);
xi=imag(x);
s_hat = (2*(xr>0)-1)+1j*(2*(xi>0)-1);
nerr = size(find([s-s_hat]),2);
ser(i) = nerr/n;
pe(i) = erfc(sqrt(1/no));
end

SRN : PES2201800220
7

semilogy(EbNo,ser,'-dk'); %simulated BER


hold on;
semilogy(EbNo,pe,'-m'); % theoritical BER
grid on;
title('SER plot for QPSK');
xlabel('E_b / N_0 in dB');
ylabel('Probability of error');

no=10^(-12/10);
nvar=no/2;
w =(randn(1,n)+1j*(randn(1,n)))*sqrt(nvar);
x=s+w;
scatterplot(x); % for E_b / N_0 = 2 dB
title('Scatterplot');
xlabel('In-Phase');
ylabel('Quadrature');
xlim([-2 2])
ylim([-2 2])

SRN : PES2201800220
8

Theory :

Frequency shift keying is a frequency modulated scheme in which digital


information is transmitted with the instantaneous changes of carrier
frequency. BFSK uses two orthogonal frequencies to represent 0 and 1.
In this scheme the 1 is called mark frequency and 0 is called space
frequency.
In binary Frequency shift keying (BFSK), the bits 0′s and 1′s are
represented by signals and having
frequencies and respectively, i.e.

SRN : PES2201800220
9

The bit error probability for coherent binary frequency shift keying is

Code :

clc;
clear all;
close all;
n=10^7;
ebn=[0:2:14];
s=double(rand(1,n)>0.5);
st=s;
si=find(s==0);
st(si)=1*j;
for i=1:length(ebn)
no=10^(-ebn(i)/10);
nvar=no/2;
w=(randn(1,n)+(j*randn(1,n)))*sqrt(nvar);
x=st+w;
xr=real(x);
xi=imag(x);
sh=double(xr>xi);
nerr=size(find(s-sh),2);
ber(i)=nerr/n;
pe(i)=0.5*erfc(sqrt(1/(2*no)));
end
semilogy(ebn,ber,'-sb');
hold on
semilogy(ebn,pe,'-*r');
title('BER OF BFSK');
xlabel('EbNo in dB');
ylabel('BER');
legend('Practical BER','Theoretical BER');

SRN : PES2201800220
10

SRN : PES2201800220
11

Theory :

The phase shift θ is the same during two consecutive signal transmission
intervals [(n-1)T, nT) and [nT, (n+1)T). The information phase sequence
{∆θ n} is still differentially encoded as before. The received waveform is
then r(t)=s(t)+n(t) . To derive the optimal receiver, the observation
interval should be taken as (n-1)T ≤ t
Pb=Pe=1/2e-Eb/N0

SRN : PES2201800220
12

Code :

clc;
clear all;
close all;
n=10^7;
s=rand(1,n)>0.5;
d=zeros(1,n+1);
d(1)=1;
for i=1:n
d(i+1)=not(xor(d(i),s(i)));
end
d=d(1,2:end);
d=2*d-1;
ebn=[-4:2:10];
for j=1:length(ebn)
no=10^((-ebn(j))/10);
nvar=no/2;
w=randn(1,n)*sqrt(nvar);
x=d+w;
xd=[1 x(1:end-1)];
sh=(x.*xd)>0;
ner=sum(abs(s-sh));
ber(j)=ner/n;
pe(j)=0.5*exp(-1/no);
end
semilogy(ebn,ber,'-dk');
hold on;
semilogy(ebn,pe,'-*m');
xlabel('Eb by No in dB');
ylabel('BER');
title('Bit error rate of DPSK');
legend('Simulated BER','Theoretical BER');

SRN : PES2201800220
13

SRN : PES2201800220

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy