SIMULATION OF BASK
MODULATION,
DEMODULATION, AND
MULTIPLEXING USING MATLAB
GROUP MEMBERS 6
AHSAN,MD RIDWAN BIN (22-49953-3)
MESHKAT MOHAMMAD (22-49035-3)
OSAMA MOBIN ZUHAR (22-49938-3)
SUFIAN MD. WALIULLAH (22-49964-3)
ARPITA CHAKRABORTY (22-48845-3)
FAHIMA ANAM EASHFI (22-48826-3)
OBJECTIVES
•Key Objective: Design and simulate Binary Amplitude Shift Keying (BASK)
modulation and demodulation using MATLAB.
•Input Data: Binary sequences generated from ASCII representation of student
surnames.
•Transmission: Two binary sequences transmitted simultaneously using different carrier
frequencies.
•Multiplexing: Signals are combined before transmission.
•Channel: Multiplexed signals are passed through a noisy channel.
•Demultiplexing & Demodulation: Signals are separated and demodulated to recover
original binary data.
•Decoding: Recovered binary vectors are decoded back into characters using ASCII for
verification.
•Significance: Demonstrates the importance of shift keying and multiplexing in digital
communication systems
INTRODUCTION
Introduction
The experiment demonstrates Binary Amplitude Shift Keying (BASK)
modulation and demodulation.
Two surnames were converted into binary signals and transmitted using
different carrier frequencies.
The signals were modulated, multiplexed, passed through noise, and then
demodulated and decoded.
The objective was to study the process and analyze the effect of noise and
SNR on system performance.
THEORETICAL ANALYSIS
BASK Modulation BASK Demodulation
BASK is a digital modulation At the receiver, the signal is
technique where the amplitude of multiplied with the same carrier
the carrier depends on the binary frequency.
input. A low-pass filter removes high-
Bit ‘1’ → Carrier is transmitted. frequency components.
Bit ‘0’ → Carrier is absent (OFF). A threshold decision rule is
Also referred to as On–Off Keying applied:
Strong signal → Bit ‘1’.
(OOK).
Weak/absent signal → Bit ‘0’.
Simple to implement but
vulnerable to noise. Performance depends on the
Signal-to-Noise Ratio (SNR).
MATLAB CODE
disp('ASCII values of surname2:');
1)
clc; disp(ascii2);
clear; bin1 = dec2bin(ascii1,8);
close all; bin2 = dec2bin(ascii2,8);
surname1 = 'AHSAN'; disp('Binary of surname1:');
surname2 = 'ARPITA'; disp(bin1);
ascii1 = double(surname1); disp('Binary of surname2:');
ascii2 = double(surname2); disp(bin2);
disp('ASCII values of surname1:'); x1 = reshape(bin1.',1,[])-'0';
disp(ascii1); x2 = reshape(bin2.',1,[])-'0';
MATLAB CODE
disp('Binary vector x1:'); xlabel('Time (s)');
disp(x1); ylabel('Amplitude’);
disp('Binary vector x2:'); title('Unipolar NRZ Transmission of
x1');
disp(x2);
grid on;
Tb = 1e-3;
t1 = 0:Tb:(length(x1)-1)*Tb;
subplot(2,1,2);
t2 = 0:Tb:(length(x2)-1)*Tb;
stairs(t2,x2,'LineWidth',2);
figure;
ylim([-0.5 1.5]);
subplot(2,1,1);
xlabel('Time (s)');
stairs(t1,x1,'LineWidth',2);
ylabel('Amplitude');
ylim([-0.5 1.5]);
title('Unipolar NRZ Transmission of
x2');
grid on;
RESULT AND DISCUSSION
(1)
Fig1: Unipolar NRZ Transmission of x1 and
x2 (Binary Representation of Surnames)
This figure illustrates the original
binary sequences x1 and x2 using
Unipolar NRZ (Non-Return-to-Zero)
encoding. Each bit is represented as
a distinct high (1) or low (0) level.
The zoomed-in view allows
verification of the exact bit patterns
and transition points, which are
essential for analyzing signal
integrity before modulation.
MATLAB CODE
t1 = 0:Tb:(length(x1)-1)*Tb;
2) clc;
clear; t2 = 0:Tb:(length(x2)-1)*Tb;
close all; figure('Name','Binary Signals in Time
Domain’);
surname1 = 'EASHFI';
subplot(2,2,1);
surname2 = 'MOBIN';
stairs(t1,x1,'LineWidth',2);
ascii1 = double(surname1);
ylim([-0.5 1.5]);
ascii2 = double(surname2);
xlabel('Time (s)');
bin1 = dec2bin(ascii1,8);
ylabel('Amplitude');
bin2 = dec2bin(ascii2,8);
title('Unipolar NRZ - x1');
x1 = reshape(bin1.',1,[])-'0';
grid on;
x2 = reshape(bin2.',1,[])-'0';
Tb = 1e-3;
MATLAB CODE
subplot(2,2,2); xlabel('Time (s)');
stairs(t2,x2,'LineWidth',2); ylabel('Amplitude');
ylim([-0.5 1.5]); title('x1 Zoomed View');
xlabel('Time (s)'); grid on;
ylabel('Amplitude'); subplot(2,2,4);
title('Unipolar NRZ - x2'); stairs(t2,x2,'g','LineWidth',1.5);
grid on; ylim([-0.5 1.5]);
subplot(2,2,3); xlabel('Time (s)');
stairs(t1,x1,'r','LineWidth',1.5); ylabel('Amplitude');
ylim([-0.5 1.5]); title('x2 Zoomed View');
grid on;
RESULT AND DISCUSSION
(2)
Fig2: Binary surname sequences
(x1 = EASHFI, x2 = MOBIN)
represented as Unipolar NRZ
signals with zoomed views
This figure presents the Binary
Amplitude Shift Keying (BASK)
modulation applied to x1 and x2. The
amplitude of the carrier signal varies
according to the binary input: high
amplitude for 1 and zero (or low)
amplitude for 0. The original binary
signals are included alongside the
modulated waveforms to demonstrate
the effect of BASK and facilitate
comparison.
MATLAB CODE
Tb = 1;
3) clc;
clear; fs = 100;
close all; t1 = 0:1/fs:(length(x1)*Tb)-1/fs;
surname1 = 'MESHKAT'; t2 = 0:1/fs:(length(x2)*Tb)-1/fs;
surname2 = 'ARPITA'; x1t = repelem(x1, fs);
ascii1 = double(surname1); x2t = repelem(x2, fs);
ascii2 = double(surname2); fc1 = 2;
bin1 = dec2bin(ascii1,8); fc2 = 4;
bin2 = dec2bin(ascii2,8); carrier1 = cos(2*pi*fc1*t1);
x1 = reshape(bin1.',1,[])-'0'; carrier2 = cos(2*pi*fc2*t2);
x2 = reshape(bin2.',1,[])-'0'; bask1 = x1t .* carrier1;
bask2 = x2t .* carrier2;
MATLAB CODE
subplot(2,2,3);
figure('Name','BASK Modulated Signals');
stairs(0:Tb:(length(x1)-1)*Tb,x1,'LineWidth',1.5);
subplot(2,2,1);
ylim([-0.5 1.5]);
plot(t1,bask1,'b','LineWidth',1.5);
xlabel('Time (s)');
xlabel('Time (s)');
ylabel('Amplitude');
ylabel('Amplitude');
title('Original x1');
title('BASK of x1 (fc = 2 Hz)');
grid on;
grid on;
subplot(2,2,4);
subplot(2,2,2);
stairs(0:Tb:(length(x2)-1)*Tb,x2,'LineWidth',1.5);
plot(t2,bask2,'r','LineWidth',1.5);
ylim([-0.5 1.5]);
xlabel('Time (s)');
xlabel('Time (s)');
ylabel('Amplitude');
ylabel('Amplitude');
title('BASK of x2 (fc = 4 Hz)');
title('Original x2');
grid on;
grid on;
RESULT AND DISCUSSION
(3)
Fig3: BASK modulation of binary
surname sequences along with
their original NRZ signals.
This figure shows the composite
signal obtained by combining the
two BASK-modulated signals and
adding Gaussian noise (SNR = 15
dB) to simulate real-world
transmission conditions. The
individual signals are displayed
alongside the noisy composite to
illustrate how noise affects the
transmitted signals and to highlight
the importance of demodulation and
filtering.
MATLAB CODE Tb = 1;
4) clc; fs = 100;
clear; t = 0:1/fs:(len*Tb)-1/fs;
close all; x1t = repelem(x1, fs);
surname1 = 'TANSHU'; x2t = repelem(x2, fs);
surname2 = 'DIPARNITA'; fc1 = 2;
ascii1 = double(surname1); fc2 = 4;
ascii2 = double(surname2); carrier1 = cos(2*pi*fc1*t);
bin1 = dec2bin(ascii1,8); carrier2 = cos(2*pi*fc2*t);
bin2 = dec2bin(ascii2,8); bask1 = x1t .* carrier1;
x1 = reshape(bin1.',1,[])-'0'; bask2 = x2t .* carrier2;
x2 = reshape(bin2.',1,[])-'0'; composite_signal = bask1 + bask2;
len = max(length(x1),length(x2)); SNR_dB = 15;
x1 = [x1 zeros(1,len-length(x1))]; noisy_signal = awgn(composite_signal, SNR_dB,
x2 = [x2 zeros(1,len-length(x2))]; 'measured');
figure('Name','Composite BASK Signal with Noise');
MATLAB CODE
subplot(3,1,1); subplot(3,1,3);
plot(t,bask1,'b','LineWidth',1.5); plot(t,noisy_signal,'k','LineWidth',1.5);
xlabel('Time (s)'); ylabel('Amplitude'); xlabel('Time (s)'); ylabel('Amplitude');
title('BASK Signal x1 (fc = 2 Hz)'); title(['Composite BASK Signal with Gaussian Noise (SNR =
',num2str(SNR_dB),' dB)']);
grid on;
grid on;
subplot(3,1,2);
plot(t,bask2,'r','LineWidth',1.5);
xlabel('Time (s)'); ylabel('Amplitude');
title('BASK Signal x2 (fc = 4 Hz)');ffffff
grid on;
RESULT AND DISCUSSION
(4)
Fig4 : BASK modulation of
binary surname sequences
(along with their noisy
composite signal..
This figure displays the signals
recovered after demodulation and
filtering. Both x1 and x2 have been
successfully extracted from the
composite noisy signal. The
recovered signals closely match the
original sequences, confirming the
effectiveness of the BASK
demodulation process and
validating the reliability of the
transmission and recovery method.
MATLAB CODE
5)clc; fc1 = 2;
clear; fc2 = 4;
close all; carrier1 = cos(2*pi*fc1*t);
x1 = [1 0 1 1 0 1 0 0]; carrier2 = cos(2*pi*fc2*t);
x2 = [0 1 1 0 1 0 1 1]; bask1 = x1t .* carrier1;
len = max(length(x1), length(x2)); bask2 = x2t .* carrier2;
x1 = [x1 zeros(1,len-length(x1))]; composite_signal = bask1 + bask2;
x2 = [x2 zeros(1,len-length(x2))]; noisy_signal = awgn(composite_signal, 15,
'measured');
Tb = 1e-3;
demod1 = noisy_signal .* carrier1;
fs = 1e4;
demod2 = noisy_signal .* carrier2;
t = 0:1/fs:len*Tb-1/fs;
[b,a] = butter(5, (1/Tb)/(fs/2));
x1t = repelem(x1, fs*Tb);
rec1 = filter(b,a,demod1);
x2t = repelem(x2, fs*Tb);
rec2 = filter(b,a,demod2);
MATLAB CODE
sample_points = subplot(3,1,2);
round(fs*Tb/2):round(fs*Tb):length(t);
stairs(t_nrz, x2_rec_t,'r','LineWidth',1.5);
x1_rec = rec1(sample_points) > 0.5;
ylim([-0.5 1.5]);
x2_rec = rec2(sample_points) > 0.5;
xlabel('Time (s)'); ylabel('Amplitude');
x1_rec_t = repelem(x1_rec, fs*Tb);
title('Recovered x2');
x2_rec_t = repelem(x2_rec, fs*Tb);
grid on;
t_nrz = t(1:length(x1_rec_t));
figure('Name','Recovered Signals (NRZ)');
subplot(3,1,3);
subplot(3,1,1);
stairs(t_nrz, x1_rec_t + x2_rec_t,'k','LineWidth',1.5);
stairs(t_nrz, x1_rec_t,'b','LineWidth',1.5);
ylim([-0.5 2.5]);
ylim([-0.5 1.5]);
xlabel('Time (s)'); ylabel('Amplitude');
xlabel('Time (s)'); ylabel('Amplitude');
title('Sum of Recovered Signals');
title('Recovered x1');
grid on;
grid on;
RESULT AND DISCUSSION
(5)
Fig5: Recovered NRZ Signals
after BASK Demodulation
Here, the binary sequences x1
and x2 are shown as they were
transmitted in the Unipolar NRZ
format before modulation. Each
bit is represented as a distinct
pulse, providing a clear view of
the transmitted data. This
visualization helps in
understanding the mapping of
binary data to signal levels and
the preparation of the signal for
subsequent modulation.
MATLAB CODE
6)clc; disp('Original and Decoded Surnames:');
clear; fprintf('Surname 1: Original = %s, Decoded = %s\n',
surname1, decoded_surname1);
surname1 = 'RIDWAN';
fprintf('Surname 2: Original = %s, Decoded = %s\n',
surname2 = 'TANSHU';
surname2, decoded_surname2);
xi = if strcmp(surname1, decoded_surname1) &&
reshape(dec2bin(double(surname1),8).',1, strcmp(surname2, decoded_surname2)
[]);
disp('The Decoded Characters Match The
x2 =
Surnames.');
reshape(dec2bin(double(surname2),8).',1,
[]); else
decode_binary = @(bin_vec) disp('Decoding error: Mismatch found.');
char(bin2dec(reshape(bin_vec,8,[]).')).';
end
decoded_surname1 = decode_binary(xi);
decoded_surname2 = decode_binary(x2);
RESULT AND DISCUSSION
(6)
Fig6: shows the surnames
being transmitted and
correctly decoded after noise
This figure shows the decoded
output displayed in the command
window: RIDWAN and TANSHU. It
confirms that the transmitted and
received data are identical,
indicating error-free transmission.
This serves as a final verification
of the entire modulation-
demodulation process, from
binary encoding to signal
recovery and decoding.
CONCLUSION
This experiment demonstrated the complete digital communication process
using Binary Amplitude Shift Keying (BASK) and Frequency Division
Multiplexing (FDM). Two surnames were transmitted simultaneously using
different carriers, combined into a single channel, and successfully recovered
at the receiver.
Advantages:
Simple implementation.
Demonstrates concept of multiplexing.
Limitations:
BASK is highly sensitive to noise.
Error rate increases significantly at low SNR.
This simulation shows the importance of choosing robust modulation
schemes for real-world communication systems.
THANK YOU
ANY QUESTION?