📄 channel.m
字号:
function varargout = channel(sig,temp,fading,snr,sim_options)
%**************************************************************************
%CHANNEL MIMO channel model.
% Y = CHANNEL(X) corrupts input signal X by desired type of channel
% fading.
%**************************************************************************
ch_conf=[2 sim_options.RxDiv];
[sig_length,space_dim,frames] = size(sig);
spowr=sum(abs(sig(:,1,1)))/sig_length;
sigma =sqrt(0.5*spowr* (10 ^ (0.1 *- snr)));
const = sqrt(2);
switch fading
case 'Rayleigh'
ch_coefs = (randn(ch_conf(1),ch_conf(2),frames) +...
i * randn(ch_conf(1),ch_conf(2),frames))/const ;
ch_noise = (randn(sig_length+temp,ch_conf(2),frames) +...
i * randn(sig_length+temp,ch_conf(2),frames)) * sigma ;
case 'AWGN'
ch_coefs = ones(ch_conf(1),ch_conf(2),frames);
ch_noise = (randn(sig_length+temp,space_dim,frames) +...
i * randn(sig_length+temp,space_dim,frames)) * sigma;
end
if temp
temp1=sig;
sig=[zeros(20,2,frames); sig];
temp=[];
pilots=[0 0 0 0 0 0 0 0 0 0 1 -1 -1 1 -1 -1 1 -1 1 1;1 -1 -1 -1 1 -1 -1 1 -1 1 0 0 0 0 0 0 0 0 0 0];
for k=1:frames
sig(:,:,k)=[pilots.'; temp1(:,:,k)];
end
end
% signal mixture
for k = 1:frames % no 3D arrays multiplication is available
sig_add(:,:,k) = sig(:,:,k) * ch_coefs(:,:,k);
end
sig_corr = (sig_add + ch_noise);
varargout = {sig_corr,ch_coefs};
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -