📄 autocorr_sim.m
字号:
function autocorr_sim=autocorr_sim(K,N,num_trials)
% AUTOCORR_SIM(M,K,N,NUM_TRAIL,FDTS)
% usage: autocorr_sim_1(2e4,3e4,1e2)
% AUTOCORR_SIM simulate the autocorrelation of the proposed fading channel model
% M is the number of sum_of_sinusoids
% K is the autocorrelation sequence length of interest
% N is the length of each channel realization
% num_trials is the number of random channel realizations
% fdTs is the normalized sampling period
% updated by HYM on 08/23/2004
autocorr_sim_matrix=zeros(num_trials,K); % store the autocorrelation of all num_trials random channel realizations
for trial=1:num_trials
% psi=2*pi*(rand(1,M)-0.5); % generate the independent and uniformly distributed parameters defined in the model
% theta=2*pi*(rand(1,1)-0.5);
% alpha=(2*pi.*[1:1:M]-pi+theta)./(4*M);
% phi=2*pi*(rand(1,1)-0.5);
% channel_realization=zeros(1,N);
% for n=1:N
% channel_realization(n)=2/sqrt(M).*complex(sum(cos(psi).*cos(2*pi*n*fdTs.*cos(alpha)+phi)),sum(sin(psi).*cos(2*pi*n*fdTs.*cos(alpha)+phi)));
% end
ch=mimo_channel(1, 1, 0, 900, 30, 250e3, N,1);
channel_realization=ch(:);
temp=xcorr(real(channel_realization),'unbias');
autocorr_sim_matrix(trial,:)=temp(N:N+K-1); % need only K autocorrelation values
end
fd=900*30*1e9/3600/3e8;
Ts=1/250e3;
fdTs=fd*Ts;
autocorr_sim=mean(autocorr_sim_matrix);
reff=besselj(0,2*pi*fdTs*[0:K-1]);
plot(fdTs.*[0:1:K-1],autocorr_sim,'b-')
hold on
plot(fdTs.*[0:1:K-1],0.5*reff,'r:');
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -