own EQ implemented and returns same performance like Toms
This commit is contained in:
@@ -1,13 +1,30 @@
|
||||
function [bits,errors,BER] = calc_ber(data_in,data_ref,skip)
|
||||
function [bits,errors,ber,errorLocation] = calc_ber(data_in,data_ref,options)
|
||||
|
||||
arguments(Input)
|
||||
data_in;
|
||||
data_ref;
|
||||
options.skip = 0;
|
||||
options.returnErrorLocation = 0;
|
||||
end
|
||||
|
||||
bits = 0;
|
||||
errors= 0;
|
||||
ber= 0;
|
||||
errorLocation= [];
|
||||
|
||||
data_ref = logical(data_ref)';
|
||||
data_in = logical(data_in)';
|
||||
|
||||
bits = 0;
|
||||
bits = bits+numel(data_in(:,skip+1:end));
|
||||
bits = bits+numel(data_in(:,options.skip+1:end));
|
||||
|
||||
try
|
||||
errors = sum( data_in(:,skip+1:end) ~= data_ref(:,skip+1:end),"all" );
|
||||
if options.returnErrorLocation == 0
|
||||
errors = sum( data_in(:,options.skip+1:end) ~= data_ref(:,options.skip+1:end),"all" );
|
||||
else
|
||||
errorLocation = sum(data_in(:,options.skip+1:end) ~= data_ref(:,options.skip+1:end),1);
|
||||
errors = sum(errorLocation ,"all" );
|
||||
end
|
||||
|
||||
catch
|
||||
%warning('BER calculation not optimal: Arrays have incompatible sizes for this operation.')
|
||||
@@ -15,6 +32,6 @@ catch
|
||||
end
|
||||
|
||||
% Determine BER
|
||||
BER = sum(errors)/sum(bits);
|
||||
ber = sum(errors)/sum(bits);
|
||||
|
||||
end
|
||||
Reference in New Issue
Block a user