fsk demodulation of iq_data

31 views (last 30 days)
sai kiran
sai kiran on 24 Apr 2024
Answered: Shashi Kiran on 26 Jul 2024
Hi all,
I am trying to demodulate the fsk modulated signal (which i generated from the vector signal generator and stored in a txt file as IQ samples). I am using the fskdemod function from matlab for demodulation, i am getting correct bits which i gave but in between there are some bit errors coming. How can i receive the correct bits?. Do i need to employ any others blocks/functions in that code? Someone please help me.
Thanks in advance

Answers (1)

Shashi Kiran
Shashi Kiran on 26 Jul 2024
As per my understanding of the question, I could see that you are facing bit errors while demodulating FSK(Frequency Shift Keying) modulated signal using fskdemod.
There are several reasons why bit errors may occur during the demodulation process, following these conditions might help achieve more accurate demodulation and reduces bit errors.
  1. Signal to Noise Ratio (SNR): Increasing the SNR, either by increasing the signal power or decreasing the noise power, reduces bit errors. This is because a higher SNR means the signal is less affected by noise.
  2. Nyquist Criterion: Ensuring that the inputs to the fskdemod function satisfy the Nyquist criterion i.e., where is the sampling frequency is the Sampling Frequency and , denote the frequency deviation and Bit rate per second respectively of the FSK transmitted signal.
Here's my sample implementation following the above conditions which might help you:
% Defining Parameters
Fs = 1e6; % Sampling frequency (Hz)
Rb = 10e3; % Bit rate (bits per second)
M = 2; % M-ary number (for binary FSK, M=2)
numBits = 1e2; % Number of bits to transmit
deviation = 8e3; % Frequency deviation (Hz)
samplesPerSymbol = Fs / Rb; % Samples per symbol
snrdB = 5; % Signal to Noise Ratio in dB
% Generate random binary data
data = randi([0 M-1], numBits, 1);
% FSK modulation
txSignal = fskmod(data, M, deviation, samplesPerSymbol, Fs);
% Add AWGN to the signal
noisySignal = awgn(txSignal, snrdB, 'measured');
% Normalize the signal
noisySignal = noisySignal / max(abs(noisySignal));
% Separate into I and Q components
I = real(noisySignal);
Q = imag(noisySignal);
IQ_samples = [I Q];
% Save IQ samples to a text file
fileID = fopen('IQ_samples.txt', 'w');
fprintf(fileID, '%f %f\n', IQ_samples');
fclose(fileID);
% Read IQ samples from the text file
IQ_samples = load('IQ_samples.txt');
% Separate the IQ samples into I and Q components
I = IQ_samples(:, 1);
Q = IQ_samples(:, 2);
% Combine I and Q components into a complex signal
rxSignal = I + 1i * Q;
% FSK demodulation
rxData = fskdemod(rxSignal, M, deviation, samplesPerSymbol, Fs);
% Calculate BER
[numErrors, ~] = biterr(data, rxData);
disp(['Number of bit errors: ', num2str(numErrors)]);
Number of bit errors: 0
In the code provided above, I generated a random data, and Frequency Shift Keying (FSK) modulation is performed using the fskmod function. Noise is then added to the modulated signal with a predefined Signal-to-Noise Ratio (SNR). The IQ samples are saved to a text file, read back, and the I and Q components are extracted. FSK demodulation is carried out using the fskdemod function.
For further help, I suggest you go through the following resources
  1. https://in.mathworks.com/help/comm/ref/fskdemod.html?s_tid=doc_ta#d126e47038
  2. Sklar, Bernard. Digital Communications: Fundamentals and Applications. 2nd ed. Upper Saddle River, N.J: Prentice-Hall PTR, 2001.
I hope it helps!

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!