function [total_coeff, Att, Re, T2] = transmission_function(eps1, eps2, alpha, h, x)
%Att = attenuation coeff through top layer
%reflectivity of sub relative to its free space value
%T2 = Two-way Power Transmission Coefficient, VV polarizatoin


n1 = sqrt(eps1); %refractive index of surf
n2 = sqrt(eps2); %refractive index of sub

Att = exp(-4.*alpha.*h./cos(x)); %attenuation coeff through top layer

Re = (((n1 - n2)/(n1 + n2))./((1 - n2)/(1 + n2)))^2; %reflectivity of sub relative to its free space value

T = 1 - ((sqrt(1-((1./n1).*sin(x)).^2) - n1.*cos(x))./ (sqrt(1-((1./n1).*sin(x)).^2) + n1.*cos(x))) .^2; %two-way power transmission coefficient from Wikipedia. Depends on angle
T2 = T.^2;

total_coeff = Att .* Re .* T2;

end

