% Free Space Model (Urban)
% Free Space Model (Urban)
distance=5000;
distance2=10000;
freq=1800;
freq2=10000;
txh=2.5;
rxh=1.5;
txh2=25;
rxh2=15;
model=1;
Dist=1:0.01:distance;
Dist_Km=Dist;
Dist_m=Dist*1000;
Dist2=1:0.01:distance2;
Dist2_Km=Dist2;
Dist2_m=Dist2*1000;
Freq=freq;
c=3*1e8;
lamda=c/(Freq*1e6);
lamda2=c/(freq2*1e6);
TX_Ht=txh;
RX_Ht=rxh;
TX_Ht2=txh2;
RX_Ht2=rxh2;
% Free Space Model (Urban)
FreeSpace=10*log10((Dist_m*pi*4).^2/lamda^2);
FreeSpace2=10*log10((Dist2_m*pi*4).^2/lamda2^2);
if(model==1)
PathLoss=-FreeSpace;
PathLoss2=-FreeSpace2;
elseif(model==2)
PathLoss=-Okumura;
PathLoss2=-Okumura2;
end
plot(PathLoss);
PT = 25;
GR = 2;
GT = 14;
PT2 = 30;
GR2 = 2;
GT2 = 14;
y1 = PathLoss+(PT+GR+GT);
figure(1);
plot(y1);
title('BASE STATION 1 SIGNAL');
y2 = PathLoss2+(PT2+GR2+GT2);
figure (2);
plot(y2);
title('BASE STATION 2 SIGNAL');
RS1 = Srdb(20, 1, 10, 0, 12.2);
RS2 = Srdb(3840, 4, 293.15, 5, 12.2);
% chan=ricianchan;
% y=filter(chan,y1);
% y=y+y1;
% figure;
% plot(y);
x1=Dist;
x2=Dist2;
RS1Plot(1:(Dist+1)) = RS1;
RS2Plot(1:(Dist+1)) = RS2;
figure (3);
x=zeros(1,length(y2));
for i=1:length(x)
x(i)=-150;
end
x(250000:249999+length(x1))=y1;
plot((1:length(x)),x,'g-');
title('COMPARISON OF TWO SIGNALS');
% figure(4);
% plot(x1, y1, 'g-');
hold on;
figure(5);
% if(x(i)>y2(i))
% stt(i)=x(i);
pr(i)=y2(i);
% else
stt(i)=y2(i);
% end
end
figure (6);
plot(stt);
hold on;
plot(pp,'g');
title('SIGNAL DURING HANDOFF');