% Calculates the first order lateral stiffness of a column, S1, given:
%   Ec = (n+1) vector of column moduli
%   Ic = (n+1) vector of column inertia
%   Lc = (n+1) vector of column lengths
%   ru = (n+1) vector of upper end fixity factors
%   rl = (n+1) vector of lower end fixity factors
function S1 = Get_S1(Ec,Ic,Lc,ru,rl)
    % Verify input
    n = length(ru)-1;
    if (length(rl) ~= n+1 || length(Ec) ~= n+1 || length(Ic) ~= n+1 ||...
            length(Lc) ~= n+1 )
        S1 = -100;
        return;
    end
    
    S1 = zeros(1,n+1);
    gamma = Get_gamma(ru,rl);
    for i=1:n+1
        S1(i)= 12*Ec(i)*Ic(i)/Lc(i)^3/gamma(i);
    end
end