Experiment 3
1.Aim:
To implement and analyze Binary Frequency Shift Keying (BFSK) modulation and demodulation
using MATLAB/Simulink or any simulation tool.
2.Apparatus Required:
S.No Equipment/Software
1 MATLAB/Simulink
2 PC/Laptop
3.Theory:
Binary Frequency Shift Keying (BFSK) is a digital modulation scheme where two different carrier
frequencies represent binary '0' and '1'. The general BFSK signal is:
s(t)={Acos(2πf1t), for binary 1} S(t)={Acos(2πf2t),
for binary 0}
Where:
• A: Amplitude of the signal
• f1, f2: Frequencies representing binary 1 and 0
• t: Time
Demodulation is done using a bandpass filter or a correlator to detect the frequency
corresponding to each bit.
4.Algorithm / Procedure (MATLAB-based): Modulation:
• Generate a random binary sequence.
• Define carrier frequencies f1 and f2 for bits '1' and '0'.
• Create time vectors for bit duration.
• Modulate each bit using the respective frequency
Demodulation:
1. Multiply the received signal with both f1 and f2 carriers.
2. Use low-pass filters to extract the amplitude.
3. Compare both outputs to decide if bit is 0 or 1.
5.MATLAB Code:
clc;
clear; closeall;
%parameter
bit_rate = 10; % bits per second Tb =
1 / bit_rate; % bit duration fs = 1000;
% sampling frequency t_bit = 0:1/fs:Tb -
1/fs; % time vector for one bit f1 = 100;
% Frequency for binary 0 f2 = 200Lllll
% Frequency for binary 1
% Generate random binary data
data = randi([0, 1], 1, 10); disp('Original Data:');
disp(data); % Modulation modulated_signal = []; for
i = 1:length(data) if data(i) == 0 y = cos(2pif1t_bit);
else y = cos(2pif2t_bit); end modulated_signal =
[modulated_signal y]; end
% Time vector for entire signal t =
0:1/fs:(length(data)*Tb - 1/fs); %
Plot modulated signal figure;
plot(t, modulated_signal);
title('BFSK Modulated Signal');
xlabel('Time (s)');
ylabel('Amplitude'); grid on;
% === Coherent Demodulation === demodulated_data = zeros(1, length(data)); for i
= 1:length(data) segment = modulated_signal((i-1)length(t_bit)+1:ilength(t_bit));
t_local = t_bit;
% Correlation with both carriers corr_f1 =
sum(segment .* cos(2*pi*f1*t_local)); corr_f2 =
sum(segment .* cos(2*pi*f2*t_local));
% Decision based on maximum correlation
if corr_f1 > corr_f2
demodulated_data(i) = 0; else
demodulated_data(i) = 1; end
% Display demodulated data
disp('Demodulated Data:');
disp(demodulated_data); % Plot
comparison figure; stem(data, 'filled');
hold on; stem(demodulated_data, 'r');
legend('Original Data','Demodulated Data');
title('Original vs Demodulated Data');
xlabel('Bit Index'); ylabel('Bit Value'); grid
on;
6.Output:
8.Result:
8. Result:
The BFSK modulation and demodulation were successfully implemented. The
original and demodulated bits were compared and found to match, confirming
correct functionality.