% solving the range equation when atmospheric attenuation included
clear
Ro=50*1852/1000;  % range in clear conditions in km
Ldbkm=.01;   % loss in dB/km
alpha=-log(10^(-Ldbkm/10))/1;   % power attenuation coefficient in Np/km
R=60:1:100;
E=((Ro./R).^4).*exp(-2*alpha*R*1);
x=[min(R),max(R)];
y=[1,1];
plot(R,E,x,y,'k--')
xlabel('R in km')


A=solve('Ro^4*exp(-2*alpha*R)/R^4=1','R')
eval(A)

solve('92.6^4*exp(-2*.0023*R)/R^4=1','R')
    
