function [sa, sigma] = Sadigh_1997_horiz(M, R, T, Fault_Type, DS, arb)
% by Ting Lin 03/31/08
% Stanford University
% tinglin@stanford.edu
% Compute the Sadigh et al. ground motion prediction (1997 Seismological
% Research Letters, Vol 68, No. 1, p180).
% This script has been modified to include standard deviations for either
% arbitrary or average components of ground motion See Baker, JW, and
% Cornell, CA (2006). "Which spectral acceleration are you using?"
% Earthquake Spectra, 22(2), 293-312.
%
% This script has also been modified to correct an error in the prediction
% equation in Table 2 that occured in the original publication.
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% INPUT
%
% M = earthquake magnitude
% R = closest distance to fault rupture surface
% T = period of vibration
% Fault_Type = 0 for strike-slip fault, rake angle < 45 degrees
% = 1 for reverse fault, rake angle > 45 degrees
% or thrust fault
% DS = 1 for deep soil
% = 0 for rock
% arb = 1 for arbitrary component sigma
% = 0 for average component sigma
%
% OUTPUT
%
% sa = median spectral acceleration prediction in g
% sigma = logarithmic standard deviation of spectral acceleration
% prediction FOR AN ARBITRARY OR AVERAGE COMPONENT
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% A common period vector is used for rock and deep soil sites with the
% second period entry 0.07 sec in Table 2 and 3 changed to 0.075 sec (to be
% consistent with Table 4). This minor modification is believed to have
% little impact on the prediction results.
period = [0.001 0.075 0.10 0.20 0.30 0.40 0.50 0.75 1.00 1.50 2.00 3.00 4.00];
% Interpolate between periods if neccesary
if (length(find(period == T)) == 0)
index_low = sum(period