📄 jakes_double_channel_gen.m
字号:
function Channel_H = Jakes_double_channel_gen(Tx_n, Rx_n, Path_n, fmax, fs,
time_slot, Channel_n)
% Tx_n : the Tx antenna number
% Rx_n : the Rx antenna number
% Path_n : multipath except the main path
% fmax: the max doppler frequency.(Hz)
% fs: the sample frequency.(Hz)
% time_slot: the time duration
% Channel_n : the realization number of channel
% must agree that time_slot*fmax>=Q; if Q=0, and Path_n=0 then it is the fla
t fading.
% if Path_n=0, then it is the time-select
ive channel
% if Q=0, then it is the frequency-select
ive channel
i = sqrt(-1);
%N=64;
%N=100;
% Channel_H = zeros(Rx_n, Tx_n, Path_n, time_slot, Channel_n);
%******* for debug ******
% Tx_n=1;
% Rx_n=1;
% Path_n=2;
% fmax=500;
% fs=10000;
% time_slot=500;
% Channel_n=1;
%****** for debug *******
% result = zeros(1,time_slot);
Power_profile = sqrt(exp(-[0 ath_n]/2));
Power_profile=Power_profile/norm(Power_profile);
if fmax > 0
file = sprintf('Jakes-T%dR%dP%dD%dN%dC%d',Tx_n, Rx_n, Path_n, fs/fmax, t
ime_slot, Channel_n);
N = 8;
while(N)
if (N < 2*fmax*time_slot/fs)
N = 2*N;
else
break;
end
end
% N = 20;
N
fd = cos(2*pi*((1:N)/N))*fmax; % Generating uniformly spaced
for realization = 1:Channel_n
for tx = 1 : Tx_n
for rx = 1 : Rx_n
for path = 1 : Path_n+1
rand('state',sum(100*clock));
theta = rand(1,N)*2*pi; % Generating the uniform
phases
%theta = ([1:N]-1)/N*2*pi;
% frequencies from -fdmax to +fdmax
for t = 1:time_slot
real_time = t/fs;
one_tv_link(t) = sum((exp(i*(2*pi*fd( *real_time +
theta( ))));
end
Channel_H(rx, tx, path, :, realization) = one_tv_link*Po
wer_profile(path)/sqrt(N);
% add up the value of all path for different time_slot p
oint
% result = result+one_tv_link*Power_profile(path)/sqrt(N)
;
end
end
end
if(mod(realization,50) == 0)
fprintf(1, '.');
end
if(mod(realization,2000) == 0)
fprintf(1,'\n');
end
end
elseif fmax == 0
% generate frequency-selective channel or flat fading channel
file = sprintf('Jakes-T%dR%dP%dD%dN%dC%d',Tx_n, Rx_n, Path_n, fmax, time
_slot, Channel_n);
for realization = 1:Channel_n
for tx = 1 : Tx_n
for rx = 1 : Rx_n
for path = 1 : Path_n+1
one_tv_link = (randn(1,1)+j*randn(1,1))/sqrt(2).*ones(1,
time_slot)*Power_profile(path);
Channel_H(rx, tx, path, :, realization) = one_tv_link;
end
end
end
if(mod(realization,50) == 0)
fprintf(1, '.');
end
if(mod(realization,2000) == 0)
fprintf(1,'\n');
end
end
else
fprintf(1,'error Dopplor');
end
%tv_link= zeros(time_slot,1);
tv_link( = Channel_H(1,1,1,:,1);
%plot(10*log10(abs(tv_link)));
%plot(10*log10(abs(result)));
%hist(abs(tv_link),20);
%mean(10*log10(abs(tv_link).^2))
% save(file, 'Channel_H');
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -