Antipodal and Unipolar Analytical Curve
5 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
James Manns
am 25 Feb. 2024
Bearbeitet: David Goodmanson
am 25 Feb. 2024
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 Kommentar
John D'Errico
am 25 Feb. 2024
Bearbeitet: John D'Errico
am 25 Feb. 2024
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?
Akzeptierte Antwort
David Goodmanson
am 25 Feb. 2024
Bearbeitet: David Goodmanson
am 25 Feb. 2024
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 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Modulation finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!