📄 channel_model.m
字号:
%==============================
% S-V channel model generation
%==============================
function imp_response=channel_model(ts,CM)
% ts : sampling time (nsec)
if nargin==0
ts = 0.167; % 根据提案的频带范围确定
CM = 1;
end
%S-V模型的参数
if CM == 1
Lam=0.0233;
lambda=3.75;
Gam=7.1;
gamma=4.37;
std_ln=4.8;
elseif CM == 2
Lam=0.4;
lambda=1;
Gam=5.2;
gamma=6.5067;
std_ln=4.8;
elseif CM == 3
Lam=0.0667;
lambda=3;
Gam=14.93;
gamma=7.03;
std_ln=4.8;
else CM == 4
Lam=0.0667;
lambda=3;
Gam=17;
gamma=12;
std_ln=4.8;
end
% Lam=0.0233; % 修改1:Cluster arrival rate,(1/nsec) Lam
% % CM1为0.0233,CM2为0.4,CM3为0.0667,CM4为0.0667
% lambda=3.75; % 修改2:Ray arrival rate ,(1/nsec) lambda
% % CM1为3.75,CM2为1,CM3为3,CM4为3
% Gam=7.1; % 修改3:Cluster decay factor,Gam
% % CM1为7.1,CM2为5.2,CM3为14.93,CM4为17
% gamma=4.37; % 修改4:Ray decay factor,gamma
% % CM1为4.37,CM2为6.5067,CM3为7.03,CM4为12
% std_ln=4.8; % 修改5:total std of log-normal shadowing for each multipath arrival
% % CM1为4.8,CM2为4.8,CM3为4.8,CM4为4.8
std_ln_1=4.8/sqrt(2); % Standard deviation of log-normal variable associated with Clusters
std_ln_2=4.8/sqrt(2); % Standard deviation of log-normal variable Rays within a cluster
std_L=sqrt(1/(2*Lam));
std_lam=sqrt(1/(2*lambda));
index_imp_resp=floor((10*Gam+10*gamma)/ts)+1;
imp_response=zeros(index_imp_resp,1);
% Determine Cluster arrivals
Tc=0; % 修改6:First cluster arrival occurs at time 0
%根据需要选择第一簇到达时间的设定
% Tc=(std_L*randn)^2+(std_L*randn)^2; % allow for random first arrival
while (Tc<10*Gam)
tmp_imp_response=zeros(floor((10*Gam+10*gamma)/ts)+1,1);
tmp_imp_response_index=floor(Tc/ts)+1;
mu=(-10*Tc/Gam)/log(10)-(std_ln)^2*log(10)/20;
ln_rv_temp=std_ln_1*randn; % Cluster shadowing
ln_rv=mu+std_ln_1*randn+ln_rv_temp; % first cluster arrival fading
% ln_rv=mu+std_ln*randn;
pk=2*round(rand)-1;
tmp_imp_response(tmp_imp_response_index)=10^(ln_rv/20)*pk;
% Determine Ray arrivals for each cluster
Tr=(std_lam*randn)^2+(std_lam*randn)^2;
while (Tr<10*gamma)
tmp_imp_response_index=floor((Tc+Tr)/ts)+1;
mu=(-10*Tc/Gam)/log(10)+(-10*Tr/gamma)/log(10)-(std_ln)^2*log(10)/20; % this assumes log(Omega)=0
ln_rv=mu+std_ln_2*randn+ln_rv_temp; % Ray fading
% ln_rv=mu+std_ln*randn;
pk=2*round(rand)-1;
tmp_imp_response(tmp_imp_response_index)=10^(ln_rv/20)*pk;
Tr=Tr+(std_lam*randn)^2+(std_lam*randn)^2;
end;
imp_response=imp_response+tmp_imp_response; % this sums cluster and ray arrivals
Tc=Tc+(std_L*randn)^2+(std_L*randn)^2;
end;
% 归一化能量
imp_response=imp_response/sqrt(imp_response'*imp_response);
imp_response=imp_response';
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -