- https://www.mathworks.com/help/matlab/ref/randi.html
- https://www.mathworks.com/help/comm/ref/berawgn.html
Shift in noise immunity of FSK signal at different frequency spacing
3 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
The code below is an FSK modulated signal noise immunity script that shows the signal immunity to noise at different frequency spacings.
One of the characteristics of the FSK signal's noise immunity is that it will improve at frequencies that are multiples of 1/T. This is explained by the fact that the scalar product of cosine waves with frequencies that are multiples of 1/T is equal to zero and, accordingly, the signals minimally influence each other during FSK modulation.
So, for a given signal length T = 0.1, noise immunity will theoretically be maximum at separation frequencies of 10, 20, 30, etc. However, if you run this code, the maximum noise immunity values will be shifted by approximately 1 Hz. Also, for different values of T, the bias maintains a scale of about one tenth of 1/T Hz. In this case, the period for achieving the best noise immunity is 1/T Hz, which is correct.
I can't find the reason for this shift. Please give me ideas on what the problem might be, maybe even in a simple display of results, but I couldn’t find it.
close all;
clc;
clear;
% Signal parameters
Fs = 100000;
bit_rate = 10000;
T = 0.1;
num_bits = T * bit_rate;
samples_per_bit = Fs / bit_rate;
num_samples = T * Fs;
t = (0:num_samples - 1) / Fs;
SNR = 10;
% indicating the frequency spacing of bits 0 and 1
deviation_range = linspace(5, 54, 50);
ber_accumulated = zeros(length(deviation_range), 10);
% Generation of random signals followed by modulation, demodulation and error counting
% 100 values are given for averaging
for iter = 1:100
data = round(rand(1, num_bits));
for k = 1:length(deviation_range)
Fc0 = 4000;
Fc1 = Fc0 + deviation_range(k);
% FSK signal modulation
fm_signal = zeros(1, num_samples);
for i = 1:num_bits
index_start = (i-1) * samples_per_bit + 1;
index_end = i * samples_per_bit;
if data(i) == 0
fm_signal(index_start:index_end) = cos(2*pi*Fc0*t(index_start:index_end));
else
fm_signal(index_start:index_end) = cos(2*pi*Fc1*t(index_start:index_end));
end
end
Eb = (sum(abs(fm_signal).^2) / num_bits) / Fs;
noise_power = sqrt(Eb/(10^(SNR/10))/2);
noisy_signal = fm_signal + randn(size(fm_signal)) * noise_power;
% FSK signal demodulation
errors = 0;
for i = 1:num_bits
index_start = (i-1) * samples_per_bit + 1;
index_end = i * samples_per_bit;
sample = noisy_signal(index_start:index_end);
ref0 = cos(2*pi*Fc0*t(index_start:index_end));
ref1 = cos(2*pi*Fc1*t(index_start:index_end));
corr0 = sum(sample .* ref0);
corr1 = sum(sample .* ref1);
received_bit = corr1 > corr0;
errors = errors + (data(i) ~= received_bit);
end
ber_accumulated(k, iter) = errors / num_bits;
end
end
ber_average = mean(ber_accumulated, 2);
ber_theory = berawgn(SNR,'fsk',2,'coherent') * ones(size(deviation_range));
figure;
plot(deviation_range, ber_average, 'b-o');
hold on;
plot(deviation_range, ber_theory, 'r--');
xlabel('Frequency deviation (Hz)');
ylabel('BER');
title('Dependence of BER on frequency separation');
legend('experimental BER', 'theoretic BER');
grid on;
0 comentarios
Respuestas (1)
Suraj Kumar
el 26 de Sept. de 2024
Hi Melifaro,
I understand you are experiencing issues with the Bit Error Rate (BER) analysis related to frequency deviation in your FSK modulation.
To resolve these issues, you may refer to the following steps and the attached code snippets:
1. You can expand and refine the frequency deviation range to a broader range which will be crucial in capturing the optimal frequency spacings to reduce the BER.
% Frequency deviation range aligned with multiples of 1/T
deviation_range = 10:2:100;
ber_accumulated = zeros(length(deviation_range), 100);
2. You can use ‘randi’ function in MATLAB for generating random binary sequences which is a more reliable and consistent method for generating binary data.
data = randi([0, 1], 1, num_bits); % Random binary data
3. You can plot the results to visualize how frequency deviation impacts the BER.
figure;
plot(deviation_range, ber_average, 'b-o');
hold on;
plot(deviation_range, ber_theory, 'r--');
xlabel('Frequency deviation (Hz)');
ylabel('BER');
title('Dependence of BER on Frequency Separation');
legend('Experimental BER', 'Theoretical BER');
grid on;
You may refer to the output below for better understanding:
For more information on ‘randi’ or ‘berawgn’ function in MATLAB, kindly refer to the following documentations:
Hope this is helpful!
0 comentarios
Ver también
Categorías
Más información sobre FSK en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!