필터 지우기
필터 지우기

Antipodal and Unipolar Analytical Curve

조회 수: 5 (최근 30일)
James Manns
James Manns 2024년 2월 25일
편집: David Goodmanson 2024년 2월 25일
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