36 lines
1.5 KiB
Matlab
36 lines
1.5 KiB
Matlab
function [eq_signal,eq_noise,ber,numErrors] = vnle(EQ,M,rx_signal,tx_symbols,tx_bits,emulate_precode)
|
|
%VNLE Apply an equalization algorithm to the received signal and calculate BER
|
|
% This function takes an equalizer object, a received signal, and the
|
|
% transmitted symbols to apply equalization, map the received signal back to bits,
|
|
% and compute the bit error rate (BER).
|
|
%
|
|
% Inputs:
|
|
% EQ - Equalizer object that provides the equalization method
|
|
% rx_signal - Received signal that needs to be equalized
|
|
% tx_symbols - Transmitted symbols used as a reference for BER calculation
|
|
%
|
|
% Outputs:
|
|
% eq_signal - Equalized version of the received signal
|
|
% ber - Bit error rate after equalization
|
|
% numErrors - Number of bit errors detected
|
|
|
|
%FFE or VNLE
|
|
[eq_signal,eq_noise] = EQ.process(rx_signal,tx_symbols);
|
|
|
|
eq_signal = PAMmapper(M,0).quantize(eq_signal);
|
|
|
|
if emulate_precode
|
|
eq_signal = Duobinary().encode(eq_signal);
|
|
eq_signal = Duobinary().decode(eq_signal);
|
|
|
|
tx_symbols= Duobinary().encode(tx_symbols);
|
|
tx_symbols = Duobinary().decode(tx_symbols);
|
|
tx_bits = PAMmapper(M,0).demap(tx_symbols);
|
|
end
|
|
|
|
% M = numel(unique(tx_symbols.signal));
|
|
rx_bits = PAMmapper(M,0).demap(eq_signal);
|
|
|
|
[~,numErrors,ber,~] = calc_ber(rx_bits.signal,tx_bits.signal,"skip_front",100,"skip_end",150,"returnErrorLocation",1);
|
|
|
|
end |