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

📄 ieee_802_11_cases.asv

📁 这是一个关于ofdm在802.11协议下的源码
💻 ASV
📖 第 1 页 / 共 2 页
字号:
    Fading_Type = 'bell_shape';
    % Path loss break point
    d_BP_m = 10;
    % Rice
    if (distance_Tx_Rx_m < d_BP_m)
        % LOS conditions
        K_factor_dB = [3,(-100).*ones(1, size(AoA_Rx_deg, 2)-1)];
        % Shadow fading standard deviation
        ShadowFading_std_dB = 3;
    else
        % NLOS conditions
        K_factor_dB = (-100).*ones(1, size(AoA_Rx_deg, 2));
        % Shadow fading standard deviation
        ShadowFading_std_dB = 5;
    end;
    
case 'E'
    % Medbo model B - Typical large open space and office environments, 100 ns rms delay spread
    PDP_dB = [-2.5 -3.0  -3.5  -3.9  0     -1.3  -2.6   -3.9   -3.4   -5.6   -7.7   -9.9   -12.1  -14.3  -15.4  -18.4  -20.7  -24.6;   % Average power [dB]
              0    10e-9 20e-9 30e-9 50e-9 80e-9 110e-9 140e-9 180e-9 230e-9 280e-9 330e-9 380e-9 430e-9 490e-9 560e-9 640e-9 730e-9]; % Relative delay (ns)
    % Power roll-off coefficients
    Power_per_angle_dB = [-2.6 -3   -3.5 -3.9 -4.5644301 -5.6551533 -6.9751533 -8.2951533 -9.8221791 -11.785521  -13.985521 -16.185521 -18.385521 -20.585521 -22.985195 -Inf       -Inf  -Inf;
                          -Inf -Inf -Inf -Inf -1.8681171 -3.2849115 -4.5733656 -5.8619031 -7.1920408  -9.9304493 -10.343797 -14.353720 -14.767068 -18.776991 -19.982151 -22.446411 -Inf  -Inf;
                          -Inf -Inf -Inf -Inf -Inf       -Inf       -Inf       -Inf       -7.9044978  -9.6851670 -14.260649 -13.812819 -18.603831 -18.192376 -22.834619 -Inf       -Inf  -Inf;
                          -Inf -Inf -Inf -Inf -Inf       -Inf       -Inf       -Inf       -Inf       -Inf        -Inf       -Inf       -Inf       -Inf       -20.673366 -20.574381 -20.7 -24.6];
    % Tx
    AoD_Tx_deg = [105.6434.*ones(1,15)  -Inf.*ones(1,3);
                  -Inf.*ones(1,4)        293.1199.*ones(1,12)  -Inf.*ones(1,2);
                  -Inf.*ones(1,8)         61.9720.*ones(1,7)  -Inf.*ones(1,3);
                  -Inf.*ones(1,14)       275.7640.*ones(1,4)];
    AS_Tx_deg  = [36.1176.*ones(1,15)  -Inf.*ones(1,3);
                  -Inf.*ones(1,4)        42.5299.*ones(1,12)  -Inf.*ones(1,2);
                  -Inf.*ones(1,8)        38.0096.*ones(1,7)  -Inf.*ones(1,3);
                  -Inf.*ones(1,14)       38.7026.*ones(1,4)];
    Type_Tx    = 3.*ones(1, size(AoD_Tx_deg, 2));
    % Rx
    AoA_Rx_deg = [163.7475.*ones(1,15)  -Inf.*ones(1,3);
                  -Inf.*ones(1,4)        251.8792.*ones(1,12)  -Inf.*ones(1,2);
                  -Inf.*ones(1,8)         80.0240.*ones(1,7)  -Inf.*ones(1,3);
                  -Inf.*ones(1,14)       182.0000.*ones(1,4)];
    AS_Rx_deg  = [35.8768.*ones(1,15)  -Inf.*ones(1,3);
                  -Inf.*ones(1,4)        41.6812.*ones(1,12)  -Inf.*ones(1,2);
                  -Inf.*ones(1,8)        37.4221.*ones(1,7)  -Inf.*ones(1,3);
                  -Inf.*ones(1,14)       40.3685.*ones(1,4)];
    Type_Rx    = 3.*ones(1, size(AoA_Rx_deg, 2));
    % Fading
    Fading_Type = 'bell_shape';
    % Path loss break point
    d_BP_m = 20;
    % Rice
    if (distance_Tx_Rx_m < d_BP_m)
        % LOS conditions
        K_factor_dB = [6,(-100).*ones(1, size(AoA_Rx_deg, 2)-1)];
        % Shadow fading standard deviation
        ShadowFading_std_dB = 3;
    else
        % NLOS conditions
        K_factor_dB = (-100).*ones(1, size(AoA_Rx_deg, 2));
        % Shadow fading standard deviation
        ShadowFading_std_dB = 6;
    end;
    
case 'F'
    % Medbo model C - Large open space (indoor and outdoor), 150 ns rms delay spread
    PDP_dB = [-3.3 -3.6  -3.9  -4.2  0     -0.9  -1.7   -2.6   -1.5   -3.0   -4.4   -5.9   -5.3   -7.9   -9.4   -13.2  -16.3  -21.2;    % Average power [dB]
              0    10e-9 20e-9 30e-9 50e-9 80e-9 110e-9 140e-9 180e-9 230e-9 280e-9 330e-9 400e-9 490e-9 600e-9 730e-9 880e-9 1050e-9]; % Relative delay (ns)
    % Power roll-off coefficients
    Power_per_angle_dB = [-3.3 -3.6 -3.9 -4.2 -4.6474101 -5.393095  -6.293095  -7.193095  -8.2370567 -9.5792981 -11.079298  -12.579298  -14.358636  -16.731146 -19.978784 -Inf       -Inf  -Inf;
                          -Inf -Inf -Inf -Inf -1.8241629 -2.8069486 -3.5527879 -4.4527879 -5.3075764 -7.4275717  -7.0894233 -10.30481   -10.44412   -13.837355 -15.762121 -19.940313 -Inf  -Inf;
                          -Inf -Inf -Inf -Inf -Inf       -Inf       -Inf       -Inf       -5.7960011 -6.7737346 -10.475827   -9.6416705 -14.107182  -12.752335 -18.503266 -Inf       -Inf  -Inf;
                          -Inf -Inf -Inf -Inf -Inf       -Inf       -Inf       -Inf       -Inf       -Inf       -Inf        -Inf         -8.8824645 -13.319464 -18.733410 -Inf       -Inf  -Inf;
                          -Inf -Inf -Inf -Inf -Inf       -Inf       -Inf       -Inf       -Inf       -Inf       -Inf        -Inf        -Inf        -Inf       -12.947155 -14.233751 -Inf  -Inf;
                          -Inf -Inf -Inf -Inf -Inf       -Inf       -Inf       -Inf       -Inf       -Inf       -Inf        -Inf        -Inf        -Inf       -Inf       -Inf       -16.3 -21.2];
    % Tx
    AoD_Tx_deg = [56.2139.*ones(1,15)  -Inf.*ones(1,3);
                  -Inf.*ones(1,4)        183.7089.*ones(1,12)  -Inf.*ones(1,2);
                  -Inf.*ones(1,8)        153.0836.*ones(1,7)   -Inf.*ones(1,3);
                  -Inf.*ones(1,12)       112.5317.*ones(1,3)   -Inf.*ones(1,3);
                  -Inf.*ones(1,14)       291.0921.*ones(1,2)   -Inf.*ones(1,2);
                  -Inf.*ones(1,16)        62.3790.*ones(1,2)];
    AS_Tx_deg  = [41.6936.*ones(1,15)  -Inf.*ones(1,3);
                  -Inf.*ones(1,4)      55.2669.*ones(1,12)  -Inf.*ones(1,2);
                  -Inf.*ones(1,8)      47.4867.*ones(1,7)   -Inf.*ones(1,3);
                  -Inf.*ones(1,12)     27.2136.*ones(1,3)   -Inf.*ones(1,3);
                  -Inf.*ones(1,14)     33.0126.*ones(1,2)   -Inf.*ones(1,2);
                  -Inf.*ones(1,16)     38.0482.*ones(1,2)];
    Type_Tx    = 3.*ones(1, size(AoD_Tx_deg, 2));
    % Rx
    AoA_Rx_deg = [315.1048.*ones(1,15)  -Inf.*ones(1,3);
                  -Inf.*ones(1,4)        180.4090.*ones(1,12)  -Inf.*ones(1,2);
                  -Inf.*ones(1,8)         74.7062.*ones(1,7)  -Inf.*ones(1,3);
                  -Inf.*ones(1,12)       251.5763.*ones(1,3)   -Inf.*ones(1,3);
                  -Inf.*ones(1,14)        68.5751.*ones(1,2)  -Inf.*ones(1,2);
                  -Inf.*ones(1,16)       246.2344.*ones(1,2)];
    AS_Rx_deg  = [48.0084.*ones(1,15)  -Inf.*ones(1,3);
                  -Inf.*ones(1,4)      55.0823.*ones(1,12)  -Inf.*ones(1,2);
                  -Inf.*ones(1,8)      42.0885.*ones(1,7)   -Inf.*ones(1,3);
                  -Inf.*ones(1,12)     28.6161.*ones(1,3)   -Inf.*ones(1,3);
                  -Inf.*ones(1,14)     30.7745.*ones(1,2)   -Inf.*ones(1,2);
                  -Inf.*ones(1,16)     38.2914.*ones(1,2)];
    Type_Rx    = 3.*ones(1, size(AoA_Rx_deg, 2));
    % Fading
    Fading_Type = 'bell_shape_spike';
    % Path loss break point
    d_BP_m = 30;
    % Rice
    if (distance_Tx_Rx_m < d_BP_m)
        % LOS conditions
        K_factor_dB = [6,(-100).*ones(1, size(AoA_Rx_deg, 2)-1)];
        % Shadow fading standard deviation
        ShadowFading_std_dB = 3;
    else
        % NLOS conditions
        K_factor_dB = (-100).*ones(1, size(AoA_Rx_deg, 2));
        % Shadow fading standard deviation
        ShadowFading_std_dB = 6;
    end;
    
otherwise
    disp('Undefined case. Exiting...');
    %break;
    return;
end;

% PDP in linear values
PDP_linear             = [10.^(.1.*PDP_dB(1,:));
                          PDP_dB(2,:)];
Power_per_angle_linear = 10.^(.1.*Power_per_angle_dB);

% Direction of movement
DirectionOfMovement_rad = 0;

% Impact of connection direction
% Computed for both Rx and Tx, because they are both needed in call to init_Rice

% Rx
for (ii = 1:size(PDP_dB,2))
    index = transpose(find(Power_per_angle_dB(:,ii) > -Inf));
    if (~(isempty(index)))
        % Normalisation of the multimodal Laplacian PAS
        [Q, sigma_deg] = normalisation_laplacian(size(index, 2), ...
                         Power_per_angle_linear(index, ii), ...
                         AS_Rx_deg(index,ii).', ...
                         180.*ones(1, size(index, 2)));
        % Computation of the composite Azimuth Spread (AS)
        if (size(index, 2) > 1)
            [AngleAtRx_deg(ii), ASAtRx_deg(ii)] = ...
            stat_laplacian(size(index, 2), Q, AoA_Rx_deg(index, ii).', ...
            sigma_deg, 180.*ones(1, size(index, 2)));
        else
            AngleAtRx_deg(ii) = AoA_Rx_deg(index, ii);
            ASAtRx_deg(ii)    = sigma_deg;
        end;
    else
        AngleAtRx_deg(ii) = -Inf;
        ASAtRx_deg(ii)    = -Inf;    
    end;
end;
    
% Tx
for (ii = 1:size(PDP_dB,2))
    index = transpose(find(Power_per_angle_dB(:,ii) > -Inf));
    if (~(isempty(index)))
        % Normalisation of the multimodal Laplacian PAS
        [Q, sigma_deg] = normalisation_laplacian(size(index, 2), ...
                         Power_per_angle_linear(index, ii), ...
                         AS_Tx_deg(index,ii).', ...
                         180.*ones(1, size(index, 2)));
        % Computation of the composite Azimuth Spread (AS)
        if (size(index, 2) > 1)
            [AngleAtTx_deg(ii), ASAtTx_deg(ii)] = ...
            stat_laplacian(size(index, 2), Q, AoD_Tx_deg(index, ii).', ...
            sigma_deg, 180.*ones(1, size(index, 2)));
        else
            AngleAtTx_deg(ii) = AoD_Tx_deg(index, ii);
            ASAtTx_deg(ii)    = sigma_deg;
        end;
    else
        AngleAtTx_deg(ii) = -Inf;
        ASAtTx_deg(ii)    = -Inf;    
    end;
end;

% If downlink, then Rx is mobile, else Tx is mobile
if strcmp(Connection, 'downlink')
    AngleAtMobile_deg = AngleAtRx_deg;
    ASAtMobile_deg    = ASAtRx_deg;
else
    AngleAtMobile_deg = AngleAtTx_deg;
    ASAtMobile_deg    = ASAtTx_deg;
end;

% Conversion to radians
AngleAtMobile_rad = AngleAtMobile_deg.*pi/180;
ASAtMobile_rad    = ASAtMobile_deg.*pi/180;
AngleAtTx_rad     = AngleAtTx_deg.*pi/180;
AngleAtRx_rad     = AngleAtRx_deg.*pi/180;

% Derivation of correlation
RTx = zeros(size(PDP_dB,2), NumberOfTxAntennas, NumberOfTxAntennas);
RRx = zeros(size(PDP_dB,2), NumberOfRxAntennas, NumberOfRxAntennas);
if strcmp(CorrelationCoefficientType,'complex')
    Type_Correlation = 0; % Complex, field correlation values
else
    Type_Correlation = 1; % Real, power correlation values
end;
for (ii = 1:size(PDP_dB,2))
    index = transpose(find(Power_per_angle_dB(:,ii) > -Inf));
    if (~isempty(index))
        [temp_RTx, QTx, sTx_deg] = correlation(NumberOfTxAntennas, SpacingTx, ...
            linspace(0,(NumberOfTxAntennas-1)*SpacingTx, NumberOfTxAntennas), ...
            size(index, 2), Power_per_angle_linear(index, ii), Type_Tx(ii), ...
            AoD_Tx_deg(index, ii).', AS_Tx_deg(index, ii).', ...
            180.*ones(1, size(index, 2)), Type_Correlation);
        [temp_RRx, QRx, sRx_deg] = correlation(NumberOfRxAntennas, SpacingRx, ...
            linspace(0,(NumberOfRxAntennas-1)*SpacingRx, NumberOfRxAntennas), ...
            size(index, 2), Power_per_angle_linear(index, ii), Type_Rx(ii), ...
            AoA_Rx_deg(index, ii).', AS_Rx_deg(index, ii).', ...
            180.*ones(1, size(index, 2)), Type_Correlation);
        RTx(ii, :, :) = temp_RTx;
        RRx(ii, :, :) = temp_RRx;
    end;
end;

% Computation of the Rice steering matrix
% AoD and AoA of the LOS component are hard-coded to 45 degrees
RiceMatrix = init_Rice(NumberOfTxAntennas, SpacingTx, pi/4, ...
                       NumberOfRxAntennas, SpacingRx, pi/4);

% Path loss computation (two-slope model with breakpoint)
disp(' ');
if (distance_Tx_Rx_m > d_BP_m)
    disp(['Scenario: Model ',ID,' in NLOS conditions with a distance of ',...
          num2str(distance_Tx_Rx_m),' meters between Tx and Rx']);
    PathLoss_dB = 20*log10(4*pi*CarrierFrequency_Hz/3e8) ...
                + 20*log10(d_BP_m) ...
                + (35*log10(distance_Tx_Rx_m/d_BP_m));
else
    disp(['Scenario: Model ',ID,' in LOS conditions with a distance of ',...
          num2str(distance_Tx_Rx_m),' meters between Tx and Rx']);
    PathLoss_dB = 20*log10(4*pi*CarrierFrequency_Hz/3e8) ...
                + 20*log10(distance_Tx_Rx_m);
end;

% Shadow fading computation (zero-mean Gaussian distribution in dB)
ShadowFading_dB = randn(1)*ShadowFading_std_dB;

⌨️ 快捷键说明

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