nr channel estimation using csi-凯发k8网页登录
this example shows how to generate channel state information reference signal (csi-rs) symbols and indices for a given carrier and csi-rs resource configuration, as defined in ts 38.211 section 7.4.1.5. the example shows how to map the generated symbols to the carrier resource grid, performs channel estimation at the receiver side, and compares the estimated channel against the actual channel.
introduction
csi-rs is a downlink-specific (dl) reference signal. the nr standard defines zero-power (zp) and non-zero-power (nzp) csi-rss.
the user equipment (ue) processes utilize nzp-csi-rss:
l1-reference signal received power (rsrp) measurements for mobility and beam management
dl csi acquisition
interference measurement
time and frequency tracking
zp-csi-rs is used for dl csi acquisition and interference measurement. it also masks certain resource elements (res) to make them unavailable for pdsch transmission. as the name zp indicates, nothing is transmitted in those res.
this example shows how to use csi-rs to perform channel estimation which forms the basis of csi acquisition.
initialize configuration objects
create a carrier configuration object representing a 5 mhz carrier with subcarrier spacing of 15 khz.
carrier = nrcarrierconfig; carrier.nsizegrid = 25; carrier.subcarrierspacing = 15; carrier.nslot = 1; carrier.nframe = 0
carrier = nrcarrierconfig with properties: ncellid: 1 subcarrierspacing: 15 cyclicprefix: 'normal' nsizegrid: 25 nstartgrid: 0 nslot: 1 nframe: 0 read-only properties: symbolsperslot: 14 slotspersubframe: 1 slotsperframe: 10
create a csi-rs configuration object representing two csi-rs resources, nzp with row number 3 and zp with row number 5.
csirs = nrcsirsconfig; csirs.csirstype = {'nzp','zp'}; csirs.csirsperiod = {[5 1],[5 1]}; csirs.density = {'one','one'}; csirs.rownumber = [3 5]; csirs.symbollocations = {1,6}; csirs.subcarrierlocations = {6,4}; csirs.numrb = 25
csirs = nrcsirsconfig with properties: csirstype: {'nzp' 'zp'} csirsperiod: {[5 1] [5 1]} rownumber: [3 5] density: {'one' 'one'} symbollocations: {[1] [6]} subcarrierlocations: {[6] [4]} numrb: 25 rboffset: 0 nid: 0 read-only properties: numcsirsports: [2 4] cdmtype: {'fd-cdm2' 'fd-cdm2'}
consider the power scaling of csi-rs in db.
powercsirs = 0; disp(['csi-rs power scaling: ' num2str(powercsirs) ' db']);
csi-rs power scaling: 0 db
generate csi-rs symbols and indices
generate csi-rs symbols for the specified carrier and csi-rs configuration parameters. apply power scaling.
sym = nrcsirs(carrier,csirs); csirssym = sym*db2mag(powercsirs);
the variable csirssym
is a column vector containing csi-rs symbols.
generate csi-rs indices for the specified carrier and csi-rs configuration parameters.
csirsind = nrcsirsindices(carrier,csirs);
the variable csirsind
is also a column vector of same size as that of csirssym
.
when you configure both zp and nzp resources, the generation of zp signals takes priority over the generation of nzp signals.
initialize carrier grid
initialize the carrier resource grid for one slot.
ports = max(csirs.numcsirsports); % number of antenna ports
txgrid = nrresourcegrid(carrier,ports);
map csi-rs symbols onto carrier grid
perform resource element mapping.
txgrid(csirsind) = csirssym;
plot the locations of the csi-rs (both zp and nzp) in the grid.
plotgrid(size(txgrid),csirsind,csirssym);
perform ofdm modulation
perform ofdm modulation to generate the time-domain waveform.
[txwaveform,ofdminfo] = nrofdmmodulate(carrier,txgrid);
pass time-domain waveform through channel and add awgn noise
configure the number of receiving antennas.
r = 4;
configure the channel.
channel = nrtdlchannel;
channel.numtransmitantennas = ports;
channel.numreceiveantennas = r;
channel.delayprofile = 'tdl-c';
channel.maximumdopplershift = 10;
channel.delayspread = 1e-8
channel = nrtdlchannel with properties: delayprofile: 'tdl-c' delayspread: 1.0000e-08 maximumdopplershift: 10 samplerate: 30720000 mimocorrelation: 'low' polarization: 'co-polar' transmissiondirection: 'downlink' numtransmitantennas: 4 numreceiveantennas: 4 normalizepathgains: true initialtime: 0 numsinusoids: 48 randomstream: 'mt19937ar with seed' seed: 73 normalizechanneloutputs: true channelfiltering: true transmitandreceiveswapped: false
based on the configured channel, append zeros to the transmitted waveform to account for the channel delay.
chinfo = info(channel); maxchdelay = ceil(max(chinfo.pathdelays*channel.samplerate)) chinfo.channelfilterdelay; txwaveform = [txwaveform; zeros(maxchdelay,size(txwaveform,2))];
pass waveform through channel.
[rxwaveform,pathgains] = channel(txwaveform);
to produce the actual propagation channel h_actual
, perform perfect channel estimation.
pathfilters = getpathfilters(channel); h_actual = nrperfectchannelestimate(carrier,pathgains,pathfilters);
add awgn noise to the waveform. for an explanation of the snr definition that this example uses, see .
snrdb = 50; % in db snr = 10^(snrdb/10); % linear value n0 = 1/sqrt(2.0*r*double(ofdminfo.nfft)*snr); % noise variance rng(0); noise = n0*complex(randn(size(rxwaveform)),randn(size(rxwaveform))); rxwaveform = rxwaveform noise;
perform timing synchronization using nzp-csi-rs. to estimate timing offset, use nrtimingestimate
and consider the nzp-csi-rs as a reference.
% disable zp-csi-rs resource, not going to be used for timing and channel % estimation csirs.csirsperiod = {[5 1],'off'}; % generate reference symbols and apply power scaling refsym = db2mag(powercsirs)*nrcsirs(carrier,csirs); % generate reference indices refind = nrcsirsindices(carrier,csirs); offset = nrtimingestimate(carrier,rxwaveform,refind,refsym)
offset = 7
rxwaveform = rxwaveform(1 offset:end,:);
ofdm demodulate the received time-domain waveform.
rxgrid = nrofdmdemodulate(carrier,rxwaveform); % of size k-by-l-by-r
compare estimated channel against actual channel
perform practical channel estimation using nzp-csi-rs. make sure the csi-rs symbols csirssym
are of the same cdm type.
cdmlen = [2 1]; % corresponds to cdmtype = 'fd-cdm2' [h_est,nvar] = nrchannelestimate(carrier,rxgrid,refind,refsym,'cdmlengths',cdmlen); estsnr = -10*log10(nvar); disp(['estimated snr = ' num2str(estsnr) ' db'])
estimated snr = 27.4577 db
plot the estimated channel and actual channel between first transmitting antenna and first receiving antenna.
figure; % plot the estimated channel subplot(1,2,1) imagesc(abs(h_est(:,:,1,1))); colorbar; title('estimated channel') axis xy; xlabel('ofdm symbols'); ylabel('subcarriers'); % plot the actual channel subplot(1,2,2) imagesc(abs(h_actual(:,:,1,1))); colorbar; title('actual channel') axis xy; xlabel('ofdm symbols'); ylabel('subcarriers');
calculate the channel estimation error.
h_err = (h_est - h_actual(:,:,:,1:size(h_est,4))); [minerr,maxerr] = bounds(abs(h_err),'all'); disp(['absolute value of the channel estimation error is in the range of [' num2str(minerr) ', ' num2str(maxerr) ']'])
absolute value of the channel estimation error is in the range of [4.9184e-06, 0.035047]
local functions
function plotgrid(gridsize,csirsind,csirssym) % plotgrid(gridsize,csirsind,csirssym) plots the carrier grid of size gridsize % by populating the grid with csi-rs symbols using csirsind and csirssym. figure() cmap = colormap(gcf); chpval = {20,2}; chpscale = 0.25*length(cmap); % scaling factor tempsym = csirssym; tempsym(tempsym ~= 0) = chpval{1}; % replacing non-zero-power symbols tempsym(tempsym == 0) = chpval{2}; % replacing zero-power symbols tempgrid = complex(zeros(gridsize)); tempgrid(csirsind) = tempsym; image(chpscale*tempgrid(:,:,1)); % multiplied with scaling factor for better visualization axis xy; names = {'nzp csi-rs','zp csi-rs'}; clevels = chpscale*[chpval{:}]; n = length(clevels); l = line(ones(n),ones(n),'linewidth',8); % generate lines % index the color map and associate the selected colors with the lines set(l,{'color'},mat2cell(cmap( min(1 clevels,length(cmap) ),:),ones(1,n),3)); % set the colors according to cmap % create legend legend(names{:}); title('carrier grid containing csi-rs') xlabel('ofdm symbols'); ylabel('subcarriers'); end
references
[1] 3gpp ts 38.211. “nr; physical channels and modulation.” 3rd generation partnership project; technical specification group radio access network.
see also
functions
- |
objects
- |