40 lines
1.5 KiB
Matlab
40 lines
1.5 KiB
Matlab
function [airs] = calc_air_plain(noisy_signal,reference_signal,options)
|
||
% Calculation of AIR acc. to J. Kozesnik, „Numerically Computing Achievable Rates of Memoryless Channels“, Francisco Javier Garcıa-Gomez, doi: 10.1007/978-94-009-9857-5.
|
||
% Implementation is not accessible, I mailed TUM to get the code...
|
||
|
||
arguments(Input)
|
||
noisy_signal;
|
||
reference_signal;
|
||
options.skip_front = 0;
|
||
options.skip_end = 0;
|
||
options.returnErrorLocation = 0;
|
||
end
|
||
|
||
options.skip_end = abs(options.skip_end);
|
||
options.skip_front = abs(options.skip_front);
|
||
|
||
assert((options.skip_end+options.skip_front)<length(noisy_signal),"You can not skip more bits than overall length of data! Set skip_front or skip_end to lower value or check data_in");
|
||
|
||
% TRIM
|
||
[noisy_signal,reference_signal]=trimseq(noisy_signal,reference_signal,options.skip_front,options.skip_end);
|
||
|
||
% CALC EVM
|
||
%%% new implementation of AIR
|
||
constellation = unique(reference_signal);
|
||
reference_idx = arrayfun(@(x) find(constellation == x, 1), reference_signal);
|
||
air = air_garcia_implementation(constellation',noisy_signal',reference_idx');
|
||
|
||
|
||
function [data_,reference_]=trimseq(data,reference,skipstart,skip_end)
|
||
|
||
data_ = data(skipstart+1:end-skip_end,:);
|
||
|
||
delta_bits = length(reference) - length(data);
|
||
|
||
skip_end = delta_bits + skip_end;
|
||
|
||
reference_ = reference(skipstart+1:end-skip_end,:);
|
||
|
||
end
|
||
|
||
end |