代码拉取完成,页面将自动刷新
同步操作将从 openKylin/cybersectookits 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
clear all
close all
clc
%% 初始设置
Moving_Speed = 0.1; % 设置设备移动速度
Sampling_Rate = 5.231e7; % 设置整体系统的采样率(Hz)
% 确定用户初始方位
Tx_Angle_B_o = [67 0 0]';
Rx_Angle_B_o = [0 33 0]';
phiLosAOA_B = 100;
%% 生成PBCH信号
sfn = 3; % System frame number
hrf = 1; % Half frame bit in SS/PBCH block transmissions, specified as 1 for the second half of a frame.
ibar_SSB = 0; % SSB位置
lssb = 8; % Number of candidate SS/PBCH blocks in a half frame, specified as 4, 8, or 64.
kssb = 20; % subcarrier offset
% Cell parameters
ncellid = 0; % physical layer cell identity number
ssbindex = 1;
v = mod(ssbindex,4);
K = 24; % Message length in bits
trblk = randi([0 1],K,1,'int8');
dmrsSym = nrPBCHDMRS(ncellid,ibar_SSB);% 生成PBCH解调参考信号
dmrsInd = nrPBCHDMRSIndices(ncellid); % 生成DMRS在网格中的位置指标
% Generate scrambled transport block
tpbchBits = nrBCH(trblk,sfn,hrf,lssb,kssb,ncellid); % 864 bits
% Generate PBCH symbols
modOut = nrPBCH(tpbchBits,ncellid,v); % 432 QPSK
% Generate PBCH location indice
pbchInd = nrPBCHIndices(ncellid);
%Generate an empty resource array for one transmitting antenna
% 生成载波(包含20个RB)默认子载波间隔15khz(caseA),14个OFDM符号(1个子帧包含1个slot,1ms)
carrier = nrCarrierConfig('NSizeGrid',20);
txGrid = nrResourceGrid(carrier); % 根据载波和生成资源网格,14个OFDMsymbol
txGrid(pbchInd) = modOut; % 将PBCH信号映射到网格中的相应位置
txGrid(dmrsInd) = dmrsSym; % 将DM-RS信号映射到网格上的相应位置
p_s = 0;
% p_an = 0;
for ii_row = 1:240
p_s = p_s + mean(abs(txGrid(ii_row,:)).^2) / 240;
% p_an = p_an + mean(abs(txGrid_an(ii_row,:)).^2) / 240;
end
%Perform OFDM modulation
[txWaveform_OFDM,info_OFDM] = nrOFDMModulate(carrier,txGrid,'SampleRate',Sampling_Rate); %1ms可以采集Sampling_Rate/1000个点
txWaveform = txWaveform_OFDM;
%% 构建cdl-UMa_Los信道
Channel_Seed_B = floor(rand(1) * 1000);
% 生成构建cdl-UMa_Los信道所的需参数
[fc_B,tauNLos_B,PNLosdb_B,PhiAOA_B,PhiAOD_B,PhiZOA_B,PhiZOD_B,K_B,CASDNLos_B,...
CASANLos_B,CZSDNLos_B,CZSANLos_B,XPRNLos_B] = CDL_Channel_UMi_Los_generate(phiLosAOA_B);
% % 生成构建cdl-UMa_NLos信道所的需参数
% [fc_B,tauNLos_B,PNLosdb_B,PhiAOA_B,PhiAOD_B,PhiZOA_B,PhiZOD_B,K_B,CASDNLos_B,...
% CASANLos_B,CZSDNLos_B,CZSANLos_B,XPRNLos_B] = CDL_Channel_UMi_NLos_generate(phiLosAOA_B);
% 构建cdl-UMa_Los信道,并生成接收信号
[rxWaveform_B_U,cdl_B] = Process_CDL_Channel_UMi(txWaveform,Sampling_Rate,Tx_Angle_B_o,Rx_Angle_B_o,...
Moving_Speed,fc_B,Channel_Seed_B,tauNLos_B,PNLosdb_B,PhiAOA_B,PhiAOD_B,PhiZOA_B,PhiZOD_B,K_B,CASDNLos_B,CASANLos_B,...
CZSDNLos_B,CZSANLos_B,XPRNLos_B);
%% 解调接收信号
E = 864; % Rate matched output length, E <= 8192
L = 8; % List length, a power of two, [1 2 4 8]
crcLen = 24; % Number of CRC bits for DL, Section 5.1, [6]
SNR_dB = 30;
SNR = 10.^(SNR_dB/10);
%% 生成加性噪声
noiseVar = p_s/SNR;
noise_B = sqrt(noiseVar/2)*(randn(Sampling_Rate/1000,32)+1i*randn(Sampling_Rate/1000,32));
rxWaveform_B = rxWaveform_B_U + noise_B;
rxGrid_B = nrOFDMDemodulate(carrier,rxWaveform_B,"SampleRate",Sampling_Rate);
% 进行信道估计
hEstGrid_B = nrChannelEstimate(rxGrid_B,dmrsInd,dmrsSym);
% Extract symbols from received signals and generate channel estimate grids
[pbchRxSym_B,pbchHest_B] = nrExtractResources(pbchInd,rxGrid_B,hEstGrid_B);
% MMSE equalization
[pbchEqSym_B,csi] = nrEqualizeMMSE(pbchRxSym_B,pbchHest_B,noiseVar);
% PBCH demodulate
[rpbchBits_B,demod_B] = nrPBCHDecode(pbchEqSym_B,ncellid,v);
% Return unscrambled transport block
[~,errFlag_B,rxtrblk_B,rxSFN4lsb_B,rxHRF_B,rxKssb_B] = nrBCHDecode( ...
double(1-2*(rpbchBits_B < 0)),L,lssb,ncellid);
% Test bit error rate
numBitErrs_B = biterr(int8(rxtrblk_B),trblk) / K;
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。