% Calculates the effective length factors, K, given:
%   ru = (n+1) vector of upper end fixity factors
%   rl = (n+1) vector of lower end fixity factors
function K = Get_K(ru,rl)
    % Verify input
    n = length(ru)-1;
    if (length(rl) ~= n+1)
        K = -100;
        return;
    end
    
    K = zeros(1,n+1);
    for i=1:n+1
        K(i)=sqrt(((pi^2+(6-pi^2).*ru(i))*(pi^2+(6-pi^2).*rl(i)))/...
            ((pi^2+(12-pi^2).*ru(i))*(pi^2+(12-pi^2).*rl(i))));
    end
end