Skip to content

Commit

Permalink
Merge pull request #8 from robmaunder/prev_EsN0
Browse files Browse the repository at this point in the history
Fixed prev_EsN0 bug.
  • Loading branch information
robmaunder authored Oct 25, 2019
2 parents 9505aee + 44b4953 commit ca94103
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions main_SNR_vs_A.m
Original file line number Diff line number Diff line change
Expand Up @@ -125,11 +125,13 @@ function main_SNR_vs_A(code, A, E, L, min_sum, target_block_errors, target_BLER,
% Initialise the BLER and SNR
BLER=1;
prev_BLER = nan;
EsN0 = EsN0_start;
prev_EsN0 = nan;
EsN0 = EsN0_start-EsN0_delta;

% Loop over the SNRs
while BLER > target_BLER
prev_EsN0 = EsN0;
EsN0 = EsN0 + EsN0_delta;

% Convert from SNR (in dB) to noise power spectral density
N0 = 1/(10^(EsN0/10));

Expand Down Expand Up @@ -184,8 +186,6 @@ function main_SNR_vs_A(code, A, E, L, min_sum, target_block_errors, target_BLER,
end
prev_BLER = BLER;
BLER = block_error_count/block_count;
prev_EsN0 = EsN0;
EsN0 = EsN0 + EsN0_delta;
end
catch ME
if strcmp(ME.identifier, 'polar_3gpp_matlab:UnsupportedBlockLength')
Expand Down

0 comments on commit ca94103

Please sign in to comment.