0% found this document useful (0 votes)
13 views7 pages

DC 8

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
13 views7 pages

DC 8

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 7

Digital Communications(EC3144)

Lab Report

October 21, 2024

Name: Gauravendra Chaudhary


Roll No: 220102077
Section: D
Branch: Electronics and Communication Engineering

1 Experiment
Modulation and BER Analysis

2 Introduction
Digital communication systems use modulation techniques like Binary Phase Shift
Keying (BPSK) and Amplitude Shift Keying (ASK) to transmit data over noisy
channels. This experiment evaluates the Bit Error Rate (BER) of BPSK and ASK with
and without pulse shaping across different Signal-to-Noise Ratios (SNR).

3 Theory
This section provides the theoretical background for Binary Phase Shift Keying
(BPSK), Amplitude Shift Keying (ASK), and the Bit Error Rate (BER) analysis in an
Additive White Gaussian Noise (AWGN) channel.

3.1 BPSK Modulation


Binary Phase Shift Keying (BPSK) modulates binary data by assigning two distinct
phases to the bit values: 0 for bit ‘1’ and π for bit ‘0’. The modulated signal can be
expressed as:
x(t) = a0 P (t)
where a0 is +1 for bit ‘1’ and 1 for bit ‘0’, and P (t) is the pulse shaping function.

1
3.2 ASK Modulation
In Amplitude Shift Keying (ASK), bit ‘1’ is represented by an amplitude A and bit ‘0’
by amplitude 0. The modulated signal is given by:

x(t) = AP (t)

3.3 Bit Error Rate (BER) Analysis


The Bit Error Rate (BER) is a key performance metric in digital communication
systems representing the probability of incorrect bit reception due to noise. The
theoretical BER for BPSK and ASK modulation schemes in an AWGN channel is given
by: !
r
2Eb
PBP SK = Q
N0
r !
Eb
PASK = Q
N0

4 Code Implementation
This section presents the MATLAB/Octave code used to simulate the BPSK and ASK
modulation schemes as well as their performance with pulse shaping.

4.1 BPSK Modulation Code

Listing 1: BPSK Modulation Code


clc ;
clear a l l ; close a l l ;
pkg load communications ;
% Number o f b i t s
N = 1 0 ˆ 5 ; % Large number o f b i t s f o r b e t t e r e r r o r e s t i m a t i o n
SNR dB values = 1 : 1 : 1 0 ; % SNR range from 1 t o 10 dB
b i t e r r o r r a t e = zeros ( s i z e ( SNR dB values ) ) ; % To s t o r e BER v a l u e s
A = 1 ; % Amplitude o f t h e BPSK s i g n a l ( Assume A=1 f o r s i m p l i c i t y )

for i d x = 1 : length ( SNR dB values )


SNR dB = SNR dB values ( i d x ) ;
% Generate random b i n a r y s e q u e n c e [ 0 , 1 ]
b i t s = r a n d i ( [ 0 , 1 ] , 1 , N) ;
% BPSK m o d u l a t i o n ( mapping : 0 −> +A, 1 −> −A)
x t = A ∗ ( 1 − 2 ∗ b i t s ) ; % C o r r e c t e d mapping
% SNR c o n v e r s i o n : Eb/No i n dB t o l i n e a r s c a l e
S N R l i n e a r = 1 0ˆ(SNR dB / 1 0 ) ;
% Assuming Eb = Aˆ2 , we g e t No from Eb/No
Eb = Aˆ 2 ; % Energy per b i t = Aˆ2
No = Eb / S N R l i n e a r ;
% Variance o f t h e n o i s e : sigma ˆ2 = No/2

2
s i g m a s q u a r e d = No / 2 ;
sigma = sqrt ( s i g m a s q u a r e d ) ;
% Generate n o i s e
n o i s e = sigma ∗ randn ( 1 , N ) ; % Normally d i s t r i b u t e d n o i s e
% Received s i g n a l r ( t ) = x ( t ) + noise
r t = x t + noise ;
% D e c i s i o n r u l e : r (T) >= 0 −> b i t 0 , r (T) < 0 −> b i t 1
d e c o d e d b i t s = zeros ( 1 , N ) ; % I n i t i a l i z e decoded b i t s
d e c o d e d b i t s ( r t >= 0 ) = 0 ; % Assign 0 f o r p o s i t i v e v a l u e s (>=0)
d e c o d e d b i t s ( r t < 0 ) = 1 ; % Assign 1 f o r n e g a t i v e v a l u e s (<0)
% Compare t h e t r a n s m i t t e d b i t s w i t h t h e r e c e i v e d b i t s
b i t e r r o r s = sum( b i t s ˜= d e c o d e d b i t s ) ; % Count b i t e r r o r s
b i t e r r o r r a t e ( i d x ) = b i t e r r o r s / N; % C a l c u l a t e b i t e r r o r r a t e
f p r i n t f ( ’SNR (dB ) : %d Number o f e r r o r s : %d B i t E r r o r Rate : %e \n ’ , SNR d
end
% R e p l a ce z e r o BER v a l u e s w i t h a s m a l l v a l u e f o r l o g p l o t
b i t e r r o r r a t e ( b i t e r r o r r a t e == 0 ) = 1e −10;
% P l o t t i n g t h e BER v s SNR c u r v e
figure ;
semilogy ( SNR dB values , b i t e r r o r r a t e , ’−o ’ , ’ DisplayName ’ , ’ Simulated BER
t i t l e ( ’BER vs SNR f o r BPSK Modulation ’ ) ;
xlabel ( ’SNR (dB) ’ ) ;
ylabel ( ’ B i t E r r o r Rate (BER) ’ ) ;
ylim ([10ˆ −10 , 1 ] ) ;
% Add t h e o r e t i c a l BER p l o t f o r comparison
b e r t h e o r e t i c a l = qfunc ( sqrt ( 2 ∗ 1 0 . ˆ ( SNR dB values / 1 0 ) ) ) ;
hold on ;
semilogy ( SNR dB values , b e r t h e o r e t i c a l , ’−− ’ , ’ DisplayName ’ , ’ T h e o r e t i c a l
legend ( ’ L o c a t i o n ’ , ’ b e s t ’ ) ;

4.2 ASK Modulation Code

Listing 2: ASK Modulation Code


clc ;
clear a l l ; close a l l ;
pkg load communications ;
% Number o f b i t s
N = 1 0 ˆ 5 ; % Large number o f b i t s f o r b e t t e r e r r o r e s t i m a t i o n
SNR dB values = 1 : 1 : 1 0 ; % SNR range from 1 t o 10 dB
b i t e r r o r r a t e = zeros ( s i z e ( SNR dB values ) ) ; % To s t o r e BER v a l u e s
% ASK p a r a m e t e r s
A = 1 ; % Amplitude f o r b i t 0 ( mapping b i t 0 t o A)
Ep = 1 ; % Energy per b i t , assume n o r m a l i z e d t o 1 f o r s i m p l i c i t y
t h r e s h o l d = A / 2 ; % T h r e s h o l d f o r d e c i s i o n r u l e : A/2
% C a l c u l a t e e n e r g y per b i t : Eb = ( 1 / 2 ) ∗ Aˆ2 ∗ Ep ( w i t h Ep = 1)
Eb = ( 1 / 2 ) ∗ Aˆ 2 ;

3
for i d x = 1 : length ( SNR dB values )
SNR dB = SNR dB values ( i d x ) ;
% Generate random b i n a r y s e q u e n c e [ 0 , 1 ]
b i t s = r a n d i ( [ 0 , 1 ] , 1 , N) ;
% ASK m o d u l a t i o n ( mapping : 0 −> A, 1 −> 0)
x t = A ∗ ( 1 − b i t s ) ; % For b i t 0 −> A, f o r b i t 1 −> 0
% SNR c o n v e r s i o n : Eb/No i n dB t o l i n e a r s c a l e
S N R l i n e a r = 1 0ˆ(SNR dB / 1 0 ) ;
% Assuming Eb = Aˆ2/2 , we g e t No from Eb/No
No = Eb / S N R l i n e a r ;
% Variance o f t h e n o i s e : sigma ˆ2 = No/2
s i g m a s q u a r e d = No / 2 ;
sigma = sqrt ( s i g m a s q u a r e d ) ;
% Generate n o i s e ( Gaussian n o i s e )
n o i s e = sigma ∗ randn ( 1 , N ) ; % Normally d i s t r i b u t e d n o i s e
% Received s i g n a l r ( t ) = x ( t ) + noise
r t = x t + noise ;
% D e c i s i o n r u l e : r (T) >= A / 2 −> b i t 0 , e l s e b i t 1
d e c o d e d b i t s = zeros ( 1 , N ) ; % I n i t i a l i z e decoded b i t s
d e c o d e d b i t s ( r t >= t h r e s h o l d ) = 0 ; % Decide b i t 0 f o r r (T) >= A/2 ( a0
d e c o d e d b i t s ( r t < t h r e s h o l d ) = 1 ; % Decide b i t 1 f o r r (T) < A/2 ( a0 =
% Compare t h e t r a n s m i t t e d b i t s w i t h t h e r e c e i v e d b i t s
b i t e r r o r s = sum( b i t s ˜= d e c o d e d b i t s ) ; % Count b i t e r r o r s
b i t e r r o r r a t e ( i d x ) = b i t e r r o r s / N; % C a l c u l a t e b i t e r r o r r a t e
f p r i n t f ( ’SNR (dB ) : %d Number o f e r r o r s : %d B i t E r r o r Rate : %e \n ’ , SNR d
end
% R e p l a ce z e r o BER v a l u e s w i t h a s m a l l v a l u e f o r l o g p l o t
b i t e r r o r r a t e ( b i t e r r o r r a t e == 0 ) = 1e −10;
% P l o t t i n g t h e BER v s SNR c u r v e
figure ;
semilogy ( SNR dB values , b i t e r r o r r a t e , ’−o ’ ) ; grid on ;
t i t l e ( ’BER vs SNR f o r ASK Modulation ’ ) ;
xlabel ( ’SNR (dB) ’ ) ;
ylabel ( ’ B i t E r r o r Rate (BER) ’ ) ;
ylim ([10ˆ −10 , 1 ] ) ;
% Add t h e o r e t i c a l BER p l o t f o r comparison ( f o r ASK)
b e r t h e o r e t i c a l = qfunc ( sqrt ( 2 ∗ 1 0 . ˆ ( SNR dB values / 1 0 ) ) ) ; % T h e o r e t i c a l
hold on ;
semilogy ( SNR dB values , b e r t h e o r e t i c a l , ’−− ’ , ’ DisplayName ’ , ’ T h e o r e t i c a l
legend ( ’ Simulated BER ’ , ’ T h e o r e t i c a l BER ’ ) ;

5 Results and Analysis


5.1 BPSK Results
At an SNR of 0 dB, the simulated BER for BPSK was 0.321. This value improved
significantly to 0.00045 at 10 dB and approached 2.3 × 10−16 at 20 dB.

4
Figure 1: Duo-binary Pulse in Time Domain and Magnitude Spectrum in Frequency
Domain

5.2 ASK Results


For ASK modulation, the BER started at 0.52 at 0 dB and dropped to 0.001 at 10 dB.
At 20 dB, the BER reduced to 7.0 × 10−12 .

Figure 2: Duo-binary Pulse in Time Domain and Magnitude Spectrum in Frequency


Domain

5
6 BPSK with Pulse Shaping Results
When pulse shaping was applied to BPSK, a significant reduction in BER was observed,
especially at lower SNRs. Pulse shaping minimizes inter-symbol in- terference and
noise, making signal detection more reliable in low SNR environ- ments. At higher SNR
values, the improvement became less pronounced.

Figure 3: Duo-binary Pulse in Time Domain and Magnitude Spectrum in Frequency


Domain

7 ASK with Pulse Shaping Results


ASK with pulse shaping showed slight improvement in BER over unshaped ASK, but it
remained more susceptible to noise compared to BPSK. The improvement in BER was
limited, suggesting that ASK’s vulnerability to noise persists, even with pulse shaping.

8 Conclusion
This experiment evaluated the Bit Error Rate (BER) of Binary Phase Shift Keying
(BPSK) and Amplitude Shift Keying (ASK) modulation schemes with and without
pulse shaping. BPSK demonstrated lower BER compared to ASK with pulse shaping
further improving its performance, especially at lower SNRs.

6
Figure 4: Duo-binary Pulse in Time Domain and Magnitude Spectrum in Frequency
Domain

You might also like