DC 8
DC 8
Lab Report
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.
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)
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.
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 ’ ) ;
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 ’ ) ;
4
Figure 1: 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.
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