function [ eps_bar ] = eps_bar( agC, Rls, T1, M_mean, R_mean, ecSoilCode )
%EPS_BAR Summary of this function goes here
%   Detailed explanation goes here

if ecSoilCode==1
    S1=0; % is there shallow alluvium
    S2=0; % is there deep alluvium
    coef=4; % 1-fault dist,raw coef; 2-fault dist,smooth coef 3-epicentral dist,raw coef; 4-epicentral dist,smooth coef
elseif ecSoilCode==2
    S1=0; % is there shallow alluvium
    S2=1; % is there deep alluvium
    coef=4; % 1-fault dist,raw coef; 2-fault dist,smooth coef 3-epicentral dist,raw coef; 4-epicentral dist,smooth coef  
elseif ecSoilCode==3
    S1=1; % is there shallow alluvium
    S2=0; % is there deep alluvium
    coef=4; % 1-fault dist,raw coef; 2-fault dist,smooth coef 3-epicentral dist,raw coef; 4-epicentral dist,smooth coef  
else
    S1=0;% is there shallow alluvium
    S2=1; % is there deep alluvium
    coef=4; % 1-fault dist,raw coef; 2-fault dist,smooth coef 3-epicentral dist,raw coef; 4-epicentral dist,smooth coef  
end

[median_sa_, sigma_] = SP_1996(T1, M_mean, R_mean, S1, S2, coef);
median_sa = median_sa_(1, 1);
sigma = sigma_(1,1);
eps_bar=(log(agC/Rls)-log(median_sa))/sigma;

end

