1# Copyright Oticon A/S 2018
2# SPDX-License-Identifier: Apache-2.0
3
4function [] = BER_test2()
5%script to test the BER calculation of the C model (second part of test_ber.c)
6
7  load ../src/test/BER.txt
8  level = BER(:,1);
9  SNR = BER(:,2);
10  BER = BER(:,3);
11
12  BER_2 = zeros(size(level));
13
14  ModulationRx = 'modulation_BLE';
15  CenterFreq = 2450e6;
16  clear ListInter
17  ListInter = {};
18
19  for level_i = level',
20    Desired.RxPower = level_i;
21    [SNR, ~] = analog_model( ListInter, Desired, ModulationRx, CenterFreq );
22    BER_2(level_i==level) = digital_ber(SNR);
23  end
24  figure(1); clf;
25  semilogy(level,BER,'r'); hold on;
26  semilogy(level,BER_2,'b'); grid on;
27  ylim([10^-8 1]); xlabel('dBm'); ylabel('BER');
28  xlim([-105 -90]);
29end
30
31