function V_scaled = scaling(V)
%% Funktion V_scaled = scaling(V) returns the scaled vector
%% V_scaled = (V-min(V))/(max(V)-min(V)) if max(V) > min(V), and the constant
%% vector V_scaled = [1 1 1 ... 1]' otherwise.  The vector V_scaled is a
%% column vector.

    %% Make V to be a coulumn vector.
    if size(V,1) < size(V,2)
        V = V';
    end
    %% V is a constant.
    if max(V) == min(V)
        V_scaled = ones(length(V),1);
    %% V is not a constant.
    else
        V_scaled = (V-min(V)) / (max(V)-min(V));
    end
end
