5.1 Title: Implementation of Frequency Shift Keying (FSK) Modulator and Demodulator
5.2 Aim of the experiment: To design and implement a Frequency Shift Keying (FSK) modulator and demodulator to demonstrate the application of digital modulation techniques.
5.3 Theoretical background for the experiment: Frequency Shift Keying (FSK) is a digital modulation technique where the frequency of the carrier signal is varied according to the binary data (1s and 0s). Two distinct frequencies are used:
Frequency for binary 1.
Frequency for binary 0.
The FSK modulated signal can be expressed a
5.4 Design:
Carrier Signals: Two sinusoidal signals of frequencies and .
Binary Data: A digital signal sequence (e.g., 101010).
Modulation: Switch between and based on the binary data.
Demodulation: Use bandpass filters to detect the presence of and .
5.5 Step by step procedure to carry out the experiment:
Define an analog input signal (e.g., binary data sequence).
Generate two carrier signals and .
Multiply binary data with the respective carrier frequencies to generate the FSK modulated signal.
For demodulation:Use bandpass filters to separate and Compare the output with a threshold to recover binary data.
Compare the recovered binary data with the original sequence
5.6 Code:
clc;
clear;
close all;
fs = 1e4;
bit_rate = 100;
fc1 = 500;
fc2 = 1000;
n_bits = 10;
data_bits = randi([0, 1], 1, n_bits);
T = 1 / bit_rate;
t = 0:1/fs:n_bits*T - 1/fs;
n_samples = length(t);
samples_per_bit = n_samples / n_bits;
fsk_signal = zeros(1, n_samples);
for i = 1:n_bits
if data_bits(i) == 0
fsk_signal((i-1)*samples_per_bit + 1:i*samples_per_bit) = cos(2 * pi * fc1 * t((i-1)*samples_per_bit + 1:i*samples_per_bit));
else
fsk_signal((i-1)*samples_per_bit + 1:i*samples_per_bit) = cos(2 * pi * fc2 * t((i-1)*samples_per_bit + 1:i*samples_per_bit));
end
end
figure;
subplot(3, 1, 1);
stairs(0:n_bits-1, data_bits, 'LineWidth', 2);
xlabel('Time (bits)');
ylabel('Amplitude');
title('Input Binary Data');
grid on;
subplot(3, 1, 2);
plot(t, fsk_signal, 'LineWidth', 1.5);
xlabel('Time (s)');
ylabel('Amplitude');
title('FSK Modulated Signal');
grid on;
demod_bits = zeros(1, n_bits);
for i = 1:n_bits
segment = fsk_signal((i-1)*samples_per_bit + 1:i*samples_per_bit);
freq_segment = abs(fft(segment));
[~, max_idx] = max(freq_segment);
if max_idx == round(fc1 * n_samples / fs)
demod_bits(i) = 0;
else
demod_bits(i) = 1;
end
end
subplot(3, 1, 3);
stairs(0:n_bits-1, demod_bits, 'LineWidth', 2);
xlabel('Time (bits)');
ylabel('Amplitude');
title('Demodulated Binary Data');
grid on;
disp('Original Bits:');
disp(data_bits);
disp('Demodulated Bits:');
disp(demod_bits);
5.7 Observations and results:
The FSK modulated signal shows frequency variations corresponding to binary 1 and binary 0.
The demodulated signals highlight the presence of and , respectively.
The recovered binary data matches the original binary sequence, confirming accurate modulation and demodulation.
5.8 Plotting of the graph:
Observations and results:
1. Frequency Shift Keying (FSK):
5.9 Conclusion of the experiment:
The FSK modulator and demodulator were successfully implemented. The experiment demonstrated how digital data could be represented using distinct carrier frequencies and accurately recovered using bandpass filtering techniques. This implementation validated the principles of Frequency Shift Keying as a digital modulation method.