+ duobinary_target now supports memoryless decoding (FFE targets DB response without MLSE) + PAMmapper.quantize now supports custom constellations for quantization + Added a new folder 'Documentations' for pdfs, slides, etc. + Added new FSO evaluation scripts in projects/FSO transmission/Evaluation Scripts + Added ffe_db (rudimentary module, not important anymore)
71 lines
2.3 KiB
Matlab
71 lines
2.3 KiB
Matlab
% einstellungen
|
|
M = 2;
|
|
apply_precode_at_tx = 0;
|
|
|
|
% daten erzeugen
|
|
bitpattern = [];
|
|
s = RandStream('twister','Seed',1);
|
|
for i = 1:log2(M)
|
|
N = 2^(17-1); %length of prbs
|
|
bitpattern(:,i) = randi(s,[0 1], N, 1);
|
|
end
|
|
|
|
if M == 6
|
|
bitpattern = reshape(bitpattern',[],1);
|
|
bitpattern = bitpattern(1:end-mod(length(bitpattern),5));
|
|
end
|
|
|
|
tx_bits = Informationsignal(bitpattern);
|
|
tx_symbols = PAMmapper(M,0).map(tx_bits);
|
|
|
|
if apply_precode_at_tx
|
|
|
|
% Precode
|
|
tx_symbols_precoded = Duobinary().precode(tx_symbols);
|
|
% Entschiedene Symbole codieren: d_DB(n) = d(n) + d(n-1) (im Fall von PAM4 7 level [0 1 2 3 4 5 6])
|
|
symbols_db = Duobinary().encode(tx_symbols_precoded);
|
|
% Entschiedene codierte Symbole decodieren: d_dec(n) = d_DB(n) mod4
|
|
rx_symbols = Duobinary().decode(symbols_db);
|
|
bits_rx = PAMmapper(M,0).demap(rx_symbols);
|
|
|
|
figure(1)
|
|
clf
|
|
hold on
|
|
stairs(tx_symbols.signal(1:100),'DisplayName','Tx Symbols','LineStyle','-','LineWidth',2);
|
|
stairs(rx_symbols.signal(1:100),'DisplayName','Rx Symbols','LineStyle',':','LineWidth',1);
|
|
legend
|
|
ylim([-2 2])
|
|
|
|
|
|
[~,~,ber,~] = calc_ber(tx_bits.signal,bits_rx.signal,"skip_front",0,"skip_end",0,"returnErrorLocation",1);
|
|
disp(['BER: ',sprintf('%.1E',ber)]);
|
|
assert(ber == 0)
|
|
else
|
|
|
|
|
|
% Entschiedene Symbole codieren: d_DB(n) = d(n) + d(n-1) (im Fall von PAM4 7 level [0 1 2 3 4 5 6])
|
|
symbols_db = Duobinary().encode(tx_symbols);
|
|
|
|
% Entschiedene codierte Symbole decodieren: d_dec(n) = d_DB(n) mod4
|
|
rx_symbols = Duobinary().decode(symbols_db);
|
|
bits_rx = PAMmapper(M,0).demap(rx_symbols);
|
|
|
|
% ref symbole precoden:
|
|
tx_symbols_ref = Duobinary().encode(tx_symbols);
|
|
tx_symbols_ref = Duobinary().decode(tx_symbols_ref);
|
|
tx_bits_ref = PAMmapper(M,0).demap(tx_symbols_ref);
|
|
|
|
% step plot to check visually if symbols overlap
|
|
figure(1)
|
|
clf
|
|
hold on
|
|
stairs(tx_symbols_ref.signal(1:100),'DisplayName','Tx Symbols','LineStyle','-','LineWidth',2);
|
|
stairs(rx_symbols.signal(1:100),'DisplayName','Rx Symbols','LineStyle',':','LineWidth',1);
|
|
legend
|
|
ylim([-2 2])
|
|
|
|
|
|
[~,~,ber,~] = calc_ber(tx_bits_ref.signal,bits_rx.signal,"skip_front",1,"skip_end",1,"returnErrorLocation",1);
|
|
disp(['BER: ',sprintf('%.1E',ber)]);
|
|
assert(ber == 0)
|
|
end |