version where the signal is flipped and added together
This commit is contained in:
@@ -1,21 +1,20 @@
|
||||
function [bits,errors,BER] = calc_ber(data_in,data_ref,skip)
|
||||
|
||||
data_ref=logical(data_ref)';
|
||||
data_in = logical(data_in)';
|
||||
data_ref = logical(data_ref)';
|
||||
data_in = logical(data_in)';
|
||||
|
||||
bits = 0;
|
||||
|
||||
% Determine BER
|
||||
|
||||
bits = bits+size(data_in,2)-skip;
|
||||
bits = bits+numel(data_in(:,skip+1:end));
|
||||
|
||||
try
|
||||
errors = sum( data_in(:,skip+1:end,:) ~= data_ref(:,skip+1:end,:),2 );
|
||||
errors = sum( data_in(:,skip+1:end) ~= data_ref(:,skip+1:end),"all" );
|
||||
|
||||
catch
|
||||
%warning('BER calculation not optimal: Arrays have incompatible sizes for this operation.')
|
||||
errors = NaN;
|
||||
end
|
||||
|
||||
% Determine BER
|
||||
BER = sum(errors)/sum(bits);
|
||||
|
||||
end
|
||||
Reference in New Issue
Block a user