Select Git revision
calc_inner_IR.m 600 B
% Copyright 2018
% Open University (Katrine Rogers - k.s.rogers@open.ac.uk)
% University of Southampton (Edward Rogers - etr@orc.soton.ac.uk)
% A function which calculates the IR inside the FoV
function IR_in = calc_inner_IR(fn,ind_red)
diff_fn = diff(fn);
diff2pos_ind = find(diff_fn > 0,1,'first'); % position where function starts increasing
if isempty(diff2pos_ind) % i.e. function is decreasing evenrywhere
IR_in = 0;
elseif diff2pos_ind >= ind_red % i.e. function is decreasing inside whole considered FoV
IR_in = 0;
else
IR_in = max(fn(diff2pos_ind:ind_red))/fn(1);
end