Antipodal and Unipolar Analytical Curve

10 次查看(过去 30 天)
I can't seem to replicate the attached figure. The output from the code below is close but not matching along the curves. I've tried modifying the EB/No but can't quite see where the error is. Can you look at the code below and let me know what I'm doing wrong?
% Parameters
EbN0_dB = -1:0.1:15; % Eb/No range in dB
EbN0 = 10.^(EbN0_dB/10); % Eb/No in linear scale
Pb_antipodal_analytical = erfc(sqrt(2 * EbN0)); % Analytical Pb for antipodal
Pb_unipolar_analytical = erfc(sqrt(EbN0)); % Analytical Pb for unipolar
% Plot analytical results
figure;
semilogy(EbN0_dB, Pb_antipodal_analytical, 'b', 'LineWidth', 2);
hold on;
semilogy(EbN0_dB, Pb_unipolar_analytical, 'r', 'LineWidth', 2);
grid on;
xlabel('Eb/No (dB)');
ylabel('Bit Error Probability');
title('Analytical Bit Error Probability vs. Eb/No');
legend('Antipodal', 'Unipolar (Orthogonal)');
axis([-1, 15, 1e-7, 1]);
% Simulation parameters
numBits = 1e6; % Number of bits
numEbN0 = length(EbN0_dB);
Pb_antipodal_simulated = zeros(1, numEbN0);
Pb_unipolar_simulated = zeros(1, numEbN0);
% Simulation loop
for i = 1:numEbN0
% Generate random bits
txBits = randi([0, 1], 1, numBits);
% Antipodal modulation
antipodal_symbols = 2 * txBits - 1;
% Add noise
noise = randn(1, numBits);
received_antipodal = antipodal_symbols + sqrt(0.5/EbN0(i)) * noise;
% Decision
rxBits_antipodal = received_antipodal >= 0;
% Count errors
num_errors_antipodal = sum(rxBits_antipodal ~= txBits);
Pb_antipodal_simulated(i) = num_errors_antipodal / numBits;
% Unipolar modulation
unipolar_symbols = txBits;
% Add noise
received_unipolar = unipolar_symbols + sqrt(1/EbN0(i)) * noise;
% Decision
rxBits_unipolar = received_unipolar >= 0.5;
% Count errors
num_errors_unipolar = sum(rxBits_unipolar ~= txBits);
Pb_unipolar_simulated(i) = num_errors_unipolar / numBits;
end
% Plot simulation results
figure;
semilogy(EbN0_dB, Pb_antipodal_analytical, 'b', 'LineWidth', 2);
hold on;
semilogy(EbN0_dB, Pb_antipodal_simulated, 'b--', 'LineWidth', 2);
semilogy(EbN0_dB, Pb_unipolar_analytical, 'r', 'LineWidth', 2);
semilogy(EbN0_dB, Pb_unipolar_simulated, 'r--', 'LineWidth', 2);
grid on;
xlabel('Eb/No (dB)');
ylabel('Bit Error Probability');
title('Analytical and Simulated Bit Error Probability vs. Eb/No');
legend('Antipodal (Analytical)', 'Antipodal (Simulated)', 'Unipolar (Analytical)', 'Unipolar (Simulated)');
axis([-1, 15, 1e-7, 1]);
  1 个评论
John D'Errico
John D'Errico 2024-2-25
编辑:John D'Errico 2024-2-25
Um, you probably are not going to replicate those curves exactly using a finite size simulation. Are saying you did not get the right result from the "analytical" prediction either?

请先登录,再进行评论。

采纳的回答

David Goodmanson
David Goodmanson 2024-2-25
编辑:David Goodmanson 2024-2-25
Hello James,
For the analytical part, you get an exact match for the curves by replacing
Pb_antipodal_analytical = erfc(sqrt(2 * EbN0)); % Analytical Pb for antipodal
Pb_unipolar_analytical = erfc(sqrt(EbN0)); % Analytical Pb for unipolar
with the same thing but including some factors of 2:
Pb_antipodal_analytical = (1/2)*erfc(sqrt(EbN0)); % Analytical Pb for antipodal
Pb_unipolar_analytical = (1/2)*erfc(sqrt(EbN0/2)); % Analytical Pb for unipolar
Your unipolar simulation matches the analytic curve quite well although there are still some issues with the anitipodal simulation. (For the simulated line types I used 'b.' and 'r.' since the double dash does not appear to be helping).

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Detection, Range and Doppler Estimation 的更多信息

产品


版本

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by