function R = koef_od( x2,x1,y2,y1,ro,polarisation,Eps,z2,dz )
% R=1;
R=zeros(1,length(ro));
for index=1:1:length(ro)
    teta=acos((ro(index)^2+(hypot(x2-x1,y2-z2))^2-(index*dz+z2)^2)/(2*ro(index)*hypot(x2-x1,y2-z2)));
    p_1='vertical';
    p_2='horizontal';
    if strcmp(polarisation,p_1)==1
        X=((Eps-(cos(teta))^2)^0.5)/Eps;
    elseif strcmp(polarisation,p_2)==1
        X=(Eps-(cos(teta)^2))^0.5;
    else
        printf('Polarisation can either be vertical or horizontal')
    end
    R(index)=(sin(teta)-X)/(sin(teta)+X);
end
    
end

