function [K] = HoopStats_R2K(R)
% "HoopStats_R2K"
% R02.00
% By Sam Berens (sam.berens@york.ac.uk).
%
% Converts a resultant (mean) vector length (R) into a von Mises
% concentration parameter (K);
%
% [K] = HoopStats_R2K(R)

K = nan(size(R));
for iR = 1:1:numel(R)
    
    cR = R(iR);
    
    %% Computation:
    if (cR < 0.85) && (cR >= 0.53)
        cK = -0.4 + (1.39*cR) + (0.43/(1-cR));
    elseif cR < 0.53
        cK = (2*cR) + (cR^3) + (5*(cR^5)/6);
    else
        cK = ((cR^3) - (4*(cR^2)) + (3*cR))^-1;
    end
    
    %% Output:
    K(iR) = cK;
end

return