DC Lab Pes186

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

DC LAB

UE18EC355
MOHAMMED ZAKI SALMAN
PES2201800186
ECE 6 A
Lab 6: BIT ERROR RATE FOR BPSK

Mohammed Zaki Salman

PES2201800186

ECE 6 A

AIM OF THE EXPERIMENT :-

Generate the N=10^7 length sequence s(n) of

random QPSK symbols (+1,-1). Set Eb/No range (in dB) as -4:2:12. Plot the bit

error rate (on log scale) vs Eb/No(in dB). Use semilogy function. Plot the

theoretical NER and see if the two curves match.

THEORY:

Binary Phase Shift Keying (BPSK) is a two phase modulation

scheme, where the 0's and 1's in a binary message are represented by two

different phase states in the carrier signal: for binary 1 and. for binary 0. In digital

modulation techniques, a set of basis functions are chosen for a particular

modulation scheme.

MATLAB CODE:

clc;

clear all;

close all;

N=10^7;
EbNo=-4:2:10;

s=2*(randn(1,N)>0.5)-1; 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_hat-s)/2); Ber(i)=Nerr/N;

Pe(i)=0.5*erfc(sqrt(1/No)); end

semilogy(EbNo,Ber,'-b'); %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); xlabel("in phase");

ylabel("quadrature phase");

%xlim([-4 4]);

%ylim([-4 4]);

Lab 6: BIT ERROR RATE FOR BPSK

Mohammed Zaki Salman

PES2201800186

ECE 6 A

SIMULATED WAVEFORM
RESULT:

We have plotted the simulated and theoretical BER of BPSK

and have observed the deviation. We have also plotted the

scatter plot for BPSK.

Lab 7: BIT ERROR RATE FOR QPSK

Mohammed Zaki Salman

PES2201800186

ECE 6 A

AIM OF THE EXPERIMENT :

Generate the N=10^7 length sequence s(n) of

random QPSK symbols (+1,-1). Set Eb/No range (in dB) as -4:2:12. Plot the bit

error rate (on log scale) vs Eb/No(in dB). Use semilogy function. Plot the

theoretical NER and see if the two curves match.

THEORY:

Quadrature Phase Shift Keying (QPSK):

It is a form of Phase Shift Keying in which two bits are modulated at once,selecting

One of four possible carrier phase shifts (0, 90, 180, or 270 degrees). QPSK allows
the signal to carry twice as much information as ordinary PSK using the same

bandwidth.

MATLAB 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)/2;

nvar=no/2;

w=(randn(1,n)+1j*randn(1,n))*sqrt(nvar);

x=w+s;

s_h=(2*(real(x)>0)-1)+1j*(2*(imag(x)>0)-1);

nerr=size(find([s-s_h]),2);

ser(i)=nerr/n; pe(i)=erfc(sqrt(1/no));

end

semilogy(ebno,ser,'-m');

hold on;

semilogy(ebno,pe,'-dk');

title("ser of qpsk");

ebno=12;

nvar=10^(-ebno/10)/2; w=(randn(1,n)+1j*randn(1,n))*sqrt(nvar); x=w+s;

scatterplot(x);

Lab 7: BIT ERROR RATE FOR QPSK

Mohammed Zaki Salman

PES2201800186

ECE 6 A
RESULT :

We have plotted the simulated and theoretical BER of

QPSK and have observed the deviation. We have also plotted the

scatter plot for QPSK

Lab 8: BIT ERROR RATE FOR BFSK

Mohammed Zaki Salman

PES2201800186

ECE 6 A

THEORY:

Binary frequency-shift-keying (BFSK) is a simple and robust form of modulation, and it

has been widely used in digital communication systems. BFSK uses a pair of discrete

frequencies to transmit binary (0s and 1s) information. With this scheme, the 1 is

called the mark frequency and the 0 is called the space frequency.

MATLAB CODE

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');

Lab 8

Mohammed Zaki Salman

PES2201800186

ECE 6 A

SIMULATED WAVE FORM


RESULT :

We have plotted the simulated and theoretical BER of BFSK and have observed the

deviation.
LAB 9:BER FOR DPSK

MOHAMMED ZAKI SALMAN

PES2201800186

ECE 6A

AIM OF THE EXPERIMENT :

Generate the N = 107 length sequence s(n) of

random symbols 0'sand 1's (rand function in matlab can be used). Perform

differential encoding of the symbols generated in first step by using xnor

operation. Initial bit can be assumed to be 1 (or 0) to obtain the sequence d(n).

Convert the sequence d(n) into (+1, -1) here, Eb = 1. Set the Eb/N0 range (in dB)

as - 4:2:10. Plot the bit error rate (on log scale) vs. Eb/N0 (in dB).

Use the semilogy function.Plot the theoretical BER (the probability of error

expression) and see if the two curves match.

Explain if any discrepancy is observed.

THEORY:

Differential Phase Shift Keying DPSK, here the phase of the modulated signal is

shifted relative to the previous signal element. No reference signal is considered

here. The signal phase follows the high or low state of the previous element. This

DPSK technique doesn’t need a reference oscillator.

MATLAB CODE

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');

SIMULATED WAVEFORM

RESULT :
We have plotted the simulated and theoretical BER of DPSK
and have observed that there is deviation.

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