⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 chnlgen.m

📁 在MATLAB环境中
💻 M
字号:
function y=ChnlGen(x, snr)

% x: input signal
% snr: signal to noise ratio

%              
% multipath_mode: multipath generation method
%                     0:static multipath
% OR: observation rate in Hz
% Fs: sampling rate in Hz
% Fm: maximum doppler frequency shift in Hz
%snr=2.0;
OR=2*1e3;%TTI=0.5ms的倒数
%x=[1 1 0 1 1 0]
Fs=7.68*1e6;%Hz
Fm=50;%Hz
M=1024;%256;     %number of taps of the Doppler filter
Dop_res=0.1;     %Doppler resolution of SUI parameter in Hz (used in resampling-process)
res_accu=20;     %accuracy of resampling process
N = length(x);%No. of independent random realizations
 %ITU-VA
        tau = [0 0.31 0.71 1.09 1.73 2.51];
        pwr = [0 -1 -9 -10 -15 -20];
        K = zeros(1,length(tau));
        Dop = Fm*ones(1,length(tau));
        Fnorm = 0;

y_noisefree = x;

tau_nor = tau*1e-6*OR; % Normalized delay time
tau_nor_min = floor(min(tau_nor));
tau2 = tau_nor-tau_nor_min;
L = length(tau);       % No. of taps

Lx = length(x);
x1 = zeros(L,Lx);
for i=1:L
    if mod(tau2(i),1)==0
        x1(i,:)=cshift(x,tau2(i)); %%circular right shift
    else
        x1(i,:)=ifft(fft(x).*exp(-j*2*pi*tau2(i)/N*[0:N-1]));%!!
    end
end
     x1
    %static multipath
        P = 10.^(pwr/10);
        if (0)
            paths = sqrt(P);
        else
            s2 = P./(K+1);
            m2 = P.*K./(K+1);
            m = sqrt(m2);
            
            paths_r = sqrt(1/2)*(randn(1,L)+j*randn(1,L)).*(sqrt(s2));
            %paths_r = sqrt(1/2)*randn_complex.*(sqrt(pwr_r)); %shaoxun
            paths_c = m.*ones(1,L);
            paths = paths_r + paths_c;
        end
        paths = paths*10^(Fnorm/20);        
        y_noisefree=sum(diag(paths)*x1);   
        Chnl.PathsPwr=paths;
   
ly = length(y_noisefree);
%%%%y_noisefree=y_noisefree/(norm(y_noisefree)/sqrt(ly));
Ey = norm(y_noisefree)^2 / ly;
Noise_sigma = sqrt(Ey/(10^(snr/10))/2);
noise = Noise_sigma * (randn(1,ly) + sqrt(-1)*randn(1,ly));
y = y_noisefree + noise   ;
    



⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -