clear all;




% Pt = 1e-5; %  Watts
% 
% r  = 10;  %  meters
% 
% f  = 3.5e9; %  Hertz
% 
% T = 300; % Kelvin
% 
% k = 1.38e-23; % Boltzmann's constant.
% 
% lambda = 3e8/f;  % wavelength
% 
% n = 3.5;  % path loss exponent
% 
% NF = 5;  % Noise figure, in dB
% 
% bw = 3.5e6; % bandwidth, in Hz
% 
% SNR = 10*log10(  Pt  /   (4*pi*(r/lambda)^n  * k * T * bw * 10^(NF/10))   )



% ISM Band, 13 Mbps link.

%Pt = 1e-4; %  Watts

rvec  = logspace(0,log10(22),100);  %  meters

f  = 2.5e9; %  Hertz

T = 300; % Kelvin

k = 1.38e-23; % Boltzmann's constant.

lambda = 3e8/f;  % wavelength

n = 3;  % path loss exponent

NF = 0;  % Noise figure, in dB

bw = 80e6; % bandwidth, in Hz

rate = 1/2; % bits/channel use.

Ptvec1 = (rvec/lambda).^n  * k * T * bw * 10^(NF/10)*2^(2*rate);

Ptvecdbm1 = 10*log10(Ptvec1*1e3);

PtvecaboveDecPower1 = 10*log10(Ptvec1/(144*1e-3));

% 60 GHz band, 1 GHz bandwidth, 1 Gbps link.


% rvec  = logspace(0,3,1000);  %  meters
% 
% f  = 60e9; %  Hertz
% 
% T = 300; % Kelvin
% 
% k = 1.38e-23; % Boltzmann's constant.
% 
% lambda = 3e8/f;  % wavelength in meters
% 
% n = 3;  % path loss exponent
% 
% NF = 3;  % Noise figure, in dB
% 
% bw = 8e9; % bandwidth, in Hz
% 
% rate = 6/8; % bits/channel use.
% 
% Ptvec = 4*pi*(rvec/lambda).^n  * k * T * bw * 10^(NF/10)*2^(2*rate);
% 
% Ptvecdbm = 10*log10(Ptvec*1e3);
% 
% PtvecaboveDecPower = 10*log10(Ptvec/(144*1e-3));