?? jakes--rayleigh.txt
字號:
發(fā)信人: seabird (學(xué)習(xí)編碼中......), 信區(qū): CommTech
標(biāo) 題: Jakes模型Rayleigh信道仿真問題
發(fā)信站: 虎踞龍蟠 BBS 站 (2001年06月12日11:26:11 星期二), 站內(nèi)信件
function CH=Rayleigh_CH(t0,fs,fc,V,maxPNum,pNum,pGain,sPath,Len,fr)
% function CH=IMTCH_RL(t0,fs,fc,V,maxPNum,pNum,pGain,sPath,Len)
%
% This function is used to calculate the impulse response
% of a multipath Rayleigh fading channel.
% Parameters:
% Output:
% CH : Channel response.
% Input:
% pGain: Gain for different paths.
% t0: Initial time offset.
% fs: Sampling frequency.
% fc: Carrier frequency.
% V : Velocity of a vehicle.
% maxPNum: Maxmum number of paths.
% pNum: Actual number of paths needed.
% sPath: Paths holded in a vector to be selected.
% Notice that it begins from integer 1.
% Len: Length of response sampled along the time axis.
% fr:is the number of frame changing the start time
%% Initialization:
% The wavelength of the carrier.
lemta=3.e+8/fc;
% The Doppler frequency.
Wm=2*pi*V/lemta;
% Some parameters.
N0=maxPNum;
N =(2*N0+1)*2;
% Resetting of the in-phase and Q-phase channel response.
Xi=zeros(pNum,Len);
Xq=zeros(pNum,Len);
indice=1;
for i=1:maxPNum
if i==sPath(1,indice)
% Set beta and sita.
beta=zeros(1,N0);
sita=zeros(1,N0);
for i1=1:N0
beta(1,i1)=pi*i1/(N0+1);
sita(1,i1)=beta(1,i1)+2*pi*(i-1)/(N0+1);
end
for i1=1:Len
% Calculate cosine for different i2.
csin=zeros(1,N0);
for i2=1:N0
csin(1,i2)=cos(Wm*cos(2*pi*i2/N)*(i1/fs+t0+fr*(1.5e-5))+sita(1,i
2));
end
% Channel response.
Xi(indice,i1)=2*cos(beta)*csin'+1.414*cos(Wm*(i1/fs+t0+fr*(1.5e-5))
);
Xq(indice,i1)=2*sin(beta)*csin';
end
indice=indice+1;
end
end
%
Ch=1.414/N^0.5*(Xi+j*Xq);
%Gain evaluation:
CH=(Ch'*diag(pGain))';
info1=round(rand(1,24576));
info1=2*info1-1;
ch1=CH(1,:);
ch1=info1.*ch1;
ch1=abs(ch1);
ch1_m=sqrt(mean(ch1.*ch1));
ch1=ch1/ch1_m;
info2(1:1000)=0;
info2(1001:24576)=info1(1001:24576)
ch2=CH(1,:).*info1+CH(2,:).*info2;
ch2=abs(ch2);
ch2_m=sqrt(mean(ch2.*ch2));
ch2=ch2/ch2_m;
xx=[1:1:24576];
plot(xx,ch1,'--b',xx,ch2,'--g');
--
※ 來源:·虎踞龍蟠 BBS 站 sbbs.seu.edu.cn·[FROM: bbs.njupt.edu.cn]
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -