changes from zurich; my mac
This commit is contained in:
29
test/test_mapping_eth.m
Normal file
29
test/test_mapping_eth.m
Normal file
@@ -0,0 +1,29 @@
|
||||
|
||||
% Setup PRBS parameters
|
||||
O = 12;
|
||||
M = 2;
|
||||
N = 2^(O-1); % Length of PRBS
|
||||
randkey = 1; % Random key for random stream
|
||||
|
||||
[~, seed] = prbs(O, 1); % Initialize first seed of PRBS
|
||||
bitpattern = [];
|
||||
|
||||
s = RandStream('twister', 'Seed', randkey);
|
||||
for i = 1:log2(M)
|
||||
bitpattern(:, i) = randi(s, [0 1], N, 1);
|
||||
end
|
||||
|
||||
Tx_bits = Informationsignal(bitpattern);
|
||||
|
||||
Digi_Mod = PAMmapper(M, 0,"eth_style",1);
|
||||
|
||||
% Map bits to symbols
|
||||
Symbols = Digi_Mod.map(Tx_bits);
|
||||
|
||||
% Demap symbols back to bits
|
||||
Rx_bits = Digi_Mod.demap(Symbols);
|
||||
|
||||
[~, error_num, ber, ~] = calc_ber(Tx_bits.signal, Rx_bits.signal, ...
|
||||
"skip_front", 0, "skip_end", 0, "returnErrorLocation", 1);
|
||||
|
||||
fprintf('BER VNLE: %.1E \n',ber);
|
||||
Reference in New Issue
Block a user