%This function returns the loss in DB of a directional antenna
%based on the difference in the angle of the receiver and the angle of
%radiation
function [loss] = directional_loss(delta_angle)
%a_0 = 0.4515565021;
a_1 = 0.246335667;
a_2 = 20.6;
delta_angle = abs(delta_angle);
if (delta_angle > 180)
    delta_angle = 360 - delta_angle;
end
loss = 10*log10((cos(delta_angle*(pi/180)*a_1))^(a_2));