?? channel.m
字號:
function multipaths =Channel(T_oWave,SNR,numpaths)
%This is communication channel of the system.
%first we will declare the structure of a signal
signal=struct('data',{[]},'distance',{[]});
%create the propagation path distance for 1 chip delay
wlength =(3*10^8)*(813*10^-9);
%create a vector to hold all multipath signals
multipaths1=[];
%create 5 reflective channel objects with different amplitude gains
objects =zeros([1,5]);
objects =[0.2 0.5 0.6 0.3 0.7];
if numpaths~=0
infected = Interference(T_oWave,numpaths);
end
%create 5 multipaths
for i=1:5
multipaths1=[multipaths1 signal];
%each multipath have a different propagation delay differed by 1 chip delay
%propagation distance
multipaths1(i).distance=3000+(wlength*(i-1));
tempD=multipaths1(i).distance;
pLoss =((3*10^8/(8.69*10^8))/(4*pi*tempD))^2;
%power of the received signal after reflection +path loss
tempP=T_oWave*pLoss*objects(i);
for k=1:length(T_oWave)
%add AWGN
%SNR will determine the mean mn
pr=(real(tempP(k)))^2+(imag(tempP(k)))^2;
mn=sqrt(pr/(2*SNR));
if numpaths==1
mn =sqrt((mn^2)/2);
end
if numpaths==3
mn =sqrt((mn^2)/4);
end
if numpaths==5
mn =sqrt((mn^2)/6);
end
Anosie=mn*((randn)+(randn*sqrt(-1)));
tempP(k)=tempP(k)+Anosie;
if numpaths~=0
%add in another userˇs signal
tempP(k)=tempP(k)+(mn*infected(k));
end
end
%power of the signal after reflection+path loss+AWGN
multipaths1(i).data=tempP;
end
multipaths=multipaths1;
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -