Home > WaveComBox > Toolbox > Channel > GenerateRayleighChannelReal.m

GenerateRayleighChannelReal

PURPOSE ^

Generates one Rayleigh channel realization.

SYNOPSIS ^

function [ C, Psi ] = GenerateRayleighChannelReal(PowerDelayProfile, Para, DopplerSpectrum, nFrameSamples)

DESCRIPTION ^

 Generates one Rayleigh channel realization.

 function [ C ] = GenerateRayleighChannelReal(PowerDelayProfile, Para)
 function [ C ] = GenerateRayleighChannelReal(PowerDelayProfile, Para, DopplerSpectrum, nFrameSamples)

 The function works for SISO and MIMO, time-variant and time-invariant systems.

 Input arguments:

   PowerDelayProfile: defines the power delay profile of the channel.
   Choices are enumerated below and include ITU and 3GPP standard models.
   'OneTap' is a simple one-tap channel.

   Para: structure containing the modulation parameters.

   DopplerSpectrum: optional parameters that defines the Doppler spectrum
   of each channel tap. If not defined or 'time_invariant', channel is
   considered time-invariant. Other options are 'Jakes' and 'Flat'.

   nFrameSamples: number of samples of the frame, needs to be defined if
   DopplerSpectrum is set to 'Jakes' or 'Flat'.

 Outputs arguments:

   C: channel impulse response. Size: multidimensional array [Para.N_R, 
   Para.N_T, L] if time-invariant and [Para.N_R, Para.N_T, L, nFrameSamples]
   if time-variant.

   Psi: delay-Doppler spreading function. Size: [] if time-invariant and
   [Para.N_R, Para.N_T, L, 2*L_nu+1] if time-variant.

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function [ C, Psi ] = GenerateRayleighChannelReal(PowerDelayProfile, Para, DopplerSpectrum, nFrameSamples)
0002 % Generates one Rayleigh channel realization.
0003 %
0004 % function [ C ] = GenerateRayleighChannelReal(PowerDelayProfile, Para)
0005 % function [ C ] = GenerateRayleighChannelReal(PowerDelayProfile, Para, DopplerSpectrum, nFrameSamples)
0006 %
0007 % The function works for SISO and MIMO, time-variant and time-invariant systems.
0008 %
0009 % Input arguments:
0010 %
0011 %   PowerDelayProfile: defines the power delay profile of the channel.
0012 %   Choices are enumerated below and include ITU and 3GPP standard models.
0013 %   'OneTap' is a simple one-tap channel.
0014 %
0015 %   Para: structure containing the modulation parameters.
0016 %
0017 %   DopplerSpectrum: optional parameters that defines the Doppler spectrum
0018 %   of each channel tap. If not defined or 'time_invariant', channel is
0019 %   considered time-invariant. Other options are 'Jakes' and 'Flat'.
0020 %
0021 %   nFrameSamples: number of samples of the frame, needs to be defined if
0022 %   DopplerSpectrum is set to 'Jakes' or 'Flat'.
0023 %
0024 % Outputs arguments:
0025 %
0026 %   C: channel impulse response. Size: multidimensional array [Para.N_R,
0027 %   Para.N_T, L] if time-invariant and [Para.N_R, Para.N_T, L, nFrameSamples]
0028 %   if time-variant.
0029 %
0030 %   Psi: delay-Doppler spreading function. Size: [] if time-invariant and
0031 %   [Para.N_R, Para.N_T, L, 2*L_nu+1] if time-variant.
0032 %
0033 
0034 
0035 % This file is part of WaveComBox: www.wavecombox.com and is distributed under
0036 % the terms of the MIT license. See accompanying LICENSE file.
0037 % Original author: François Rottenberg, May 3, 2018.
0038 % Contributors:
0039 % Change log:
0040 
0041 if exist('DopplerSpectrum','var')==0
0042     DopplerSpectrum='time_invariant';
0043 end
0044 
0045 switch PowerDelayProfile
0046     case 'OneTap'
0047         % ***************************** One tap
0048         delays=0;
0049         powers=0;
0050     % ITU channel models
0051     case 'ITU_PedA'
0052         % ***************************** Pedestrian A
0053         delays=1e-9*[0 110 190 410];
0054         powers=[0 -9.7 -19.2 -22.8];
0055     case 'ITU_PedB'
0056         % ***************************** Pedestrian B
0057         delays=1e-9*[0 200 800 1200 2300 3700];
0058         powers=[0 -0.9 -4.9 -8 -7.8 -23.9];
0059     case 'ITU_EPedA'
0060         % ***************************** Extended Pedestrian A (EPA)
0061         delays=1e-9*[0 30 70 90 110 190 410];
0062         powers=[0 -1 -2 -3 -8 -17.2 -20.8];
0063     case 'ITU_VehB'
0064         % ***************************** Vehicular B  (speed 60 km/h)
0065         delays=1e-9*[0 300 8900 12900 17100 20000];
0066         powers=[-2.5 0 -12.8 -10 -25.2 -16];
0067     case 'ITU_VehA'
0068         % ***************************** Vehicular A  (speed 60 km/h)
0069         delays=1e-9*[0 300 700 1100 1700 2500];
0070         powers=[0 -1 -9 -10 -15 -20];
0071     case 'ITU_EVehA'
0072         % ***************************** Extended Vehicular A  (EVA)
0073         delays=1e-9*[0 30 150 310 370 710 1090 1730 2510];
0074         powers=[0 -1.5 -1.4 -3.6 -0.6 -9.1 -7 -12 -16.9];
0075     case 'ITU_TUA'
0076         %****************************** model TU 50 model A
0077         delays=1e-6*[0 0.217 0.512 0.514 0.517 0.674 0.882 1.230 1.287 1.311 1.349 1.533 1.535 1.622 1.818 1.836 1.884 1.943 2.048 2.140] ;
0078         powers=[ -5.7 -7.6 -10.1 -10.2 -10.2 -11.5 -13.4 -16.3 -16.9 -17.1 -17.4 -19.0 -19.0 -19.8 -21.5 -21.6 -22.1 -22.6 -23.5 -24.3];
0079     case 'ITU_ETU'
0080         %****************************** model Extended typical urban model (ETU)
0081         delays=1e-9*[0 50 120 200 230 500 1600 2300 5000];
0082         powers=[-1 -1 -1 0 0 0 -3 -5 -7];
0083     case 'IC_Hyperlan2'
0084         % ***************************** indoor channel Hyperlan 2
0085         delays=1e-9*[0 10 20 30 40 50 60 70 80 90 110 140 170 200 240 290 340 390];
0086         powers=[0 -0.9 -1.7 -2.6 -3.5 -4.3 -5.2 -6.1 -6.9 -7.8 -4.7 -7.3 -9.9 -12.5 -13.7 -18.0 -22.4 -26.7];
0087         
0088         % 3GPP TR 25.943 channel models
0089     case '3GPP_TU'
0090         % 3GPP-TU % typical urban
0091         powers = [-5.7 -7.6 -10.1 -10.2 -10.2 -11.5 -13.4 -16.3 -16.9 -17.1 -17.4 -19.0 -19.0 -19.8 -21.5 -21.6 -22.1 -22.6 -23.5 -24.3];
0092         delays = [0 217 512 514 517 674 882 1230 1287 1311 1349 1533 1535 1622 1818 1836 1884 1943 2048 2140]*1e-9;
0093         stem(delays,powers)
0094     case '3GPP_RA'
0095         %'3GPP-RA' % rural area
0096         powers = [-5.2 -6.4 -8.4 -9.3 -10 -13.1 -15.3 -18.5 -20.4 -22.4];
0097         delays = [0 42 101 129 149 245 312 410 469 528]*1e-9;
0098         stem(delays,powers)
0099     case '3GPP_HT'
0100         %'3GPP-HT' % hilly terrain
0101         powers = [-3.6 -8.9 -10.2 -11.5 -11.8 -12.7 -13 -16.2 -17.3 -17.7 -17.6 -22.7 -24.1 -25.8 -25.8 -26.2 -29 -29.9 -30 -30.7];
0102         delays = [0 356 441 528 546 609 625 842 916 941 15000 16172 16492 16876 16882 16978 17615 17827 17849 18016]*1e-9;
0103         
0104     otherwise
0105         error('"PowerDelayProfile" not defined')
0106         
0107 end
0108 
0109 Ts=Para.T/Para.nSubcarriers;
0110 delays=round(delays/Ts)+1;
0111 nbtaps=length(powers);
0112 L=max(delays);
0113 p_b=zeros(1,L);
0114 variances=10.^(powers/10);
0115 variances=variances/sum(variances);
0116 for i=1:nbtaps
0117     p_b(delays(i))=p_b(delays(i))+ variances(i);
0118 end
0119 
0120 switch DopplerSpectrum
0121     case 'time_invariant'
0122         C=zeros(Para.N_R,Para.N_T,L);
0123         Psi=[];
0124         for i=1:Para.N_R
0125             for j=1:Para.N_T
0126                 for b=1:L
0127                     C(i,j,b)=sqrt(p_b(b)/2)*(randn+1j*randn);
0128                 end
0129             end
0130         end
0131     case 'Jakes'
0132         if exist('nFrameSamples','var')==0
0133             error('Argurment "nFrameSamples" missing')
0134         end
0135         % Doppler spectrum shape
0136         c=3e8;
0137         lambda=c/Para.CenterFrequency;
0138         fd=Para.Velocity/3.6/lambda;
0139         L_nu=floor(fd*nFrameSamples*Ts);
0140         if L_nu==0
0141             p_nu=1;
0142         else            
0143             p_nu=1./sqrt(1-((-L_nu:L_nu)./(fd*nFrameSamples*Ts)).^2);
0144             p_nu=p_nu/sum(p_nu);
0145         end
0146         Psi=zeros(Para.N_R,Para.N_T,L,2*L_nu+1);
0147         for i=1:Para.N_R
0148             for j=1:Para.N_T
0149                 for b=1:L
0150                     for nu=1:2*L_nu+1
0151                         Psi(i,j,b,nu)=sqrt(p_b(b)*p_nu(nu)/2)*(randn+1j*randn);
0152                     end
0153                 end
0154             end
0155         end
0156         C=zeros(Para.N_R,Para.N_T,L,nFrameSamples);
0157         for index_N_R=1:Para.N_R
0158             for index_N_T=1:Para.N_T
0159                 for index_L=1:L
0160                     C(index_N_R,index_N_T,index_L,:)=exp(1j*2*pi/nFrameSamples*(0:nFrameSamples-1)'*(-L_nu:L_nu))*squeeze(Psi(index_N_R,index_N_T,index_L,:));
0161                 end
0162             end
0163         end
0164     case 'Flat'
0165         if exist('nFrameSamples','var')==0
0166             error('Argurment "nFrameSamples" missing')
0167         end
0168         % Doppler spectrum shape
0169         c=3e8;
0170         lambda=c/Para.CenterFrequency;
0171         fd=Para.Velocity/3.6/lambda;
0172         L_nu=floor(fd*nFrameSamples*Ts);
0173         if L_nu==0
0174             p_nu=1;
0175         else            
0176             p_nu=ones(1,2*L_nu+1);
0177             p_nu=p_nu/sum(p_nu);
0178         end
0179         Psi=zeros(Para.N_R,Para.N_T,L,2*L_nu+1);
0180         for i=1:Para.N_R
0181             for j=1:Para.N_T
0182                 for b=1:L
0183                     for nu=1:2*L_nu+1
0184                         Psi(i,j,b,nu)=sqrt(p_b(b)*p_nu(nu)/2)*(randn+1j*randn);
0185                     end
0186                 end
0187             end
0188         end
0189         C=zeros(Para.N_R,Para.N_T,L,nFrameSamples);
0190         for index_N_R=1:Para.N_R
0191             for index_N_T=1:Para.N_T
0192                 for index_L=1:L
0193                     C(index_N_R,index_N_T,index_L,:)=exp(1j*2*pi/nFrameSamples*(0:nFrameSamples-1)'*(-L_nu:L_nu))*squeeze(Psi(index_N_R,index_N_T,index_L,:));
0194                 end
0195             end
0196         end
0197     otherwise
0198         error('"DopplerSpectrum" not defined')
0199 end
0200 
0201 end
0202

Generated on Mon 24-Jun-2019 13:51:48 by m2html © 2005