Files
imdd_silas/projects/ML_based_MLSE/interp_fec_cross.m
2025-12-15 15:41:02 +01:00

14 lines
452 B
Matlab

function rop_fec = interp_fec_cross(rops, ber, fec_thr)
if all(~isfinite(ber))
rop_fec = NaN; return;
end
idx = find(ber < fec_thr, 1, 'first');
if isempty(idx) || idx == 1
rop_fec = NaN; return; % no crossing
end
% linear interpolation between the two nearest points
x1 = rops(idx-1); x2 = rops(idx);
y1 = ber(idx-1); y2 = ber(idx);
rop_fec = interp1([y1 y2], [x1 x2], fec_thr, 'linear', NaN);
end