How is the output signal obtained in nrTDLChannel?

15 views (last 30 days)
Xinhua Zheng
Xinhua Zheng on 28 Mar 2024
Edited: Abhimenyu on 5 Nov 2024 at 12:08
Hello!
How can I get rxwaveform from txwaveform using pathGains, sampleTimes, etc.? I believe this is crucial for constructing the effective channel matrix in the case of time-varying channels. Specifically as follows:
This is a simple example of a SISO case where the input waveform is transmitted through the TDL channel.
SR = 7.68e6;
tdl = nrTDLChannel;
tdl.DelayProfile = 'TDL-A';
tdl.DelaySpread = 100e-9;
tdl.MaximumDopplerShift = 0;
tdl.SampleRate = SR;
tdl.NumReceiveAntennas = 1;
tdl.NormalizeChannelOutputs = false;
tdl.NormalizePathGains = false;
T = SR*1e-3;
NRB = 25;
SCS = 15;
nSlot = 0;
carrier = nrCarrierConfig('SubcarrierSpacing',SCS,'NSizeGrid',NRB);
trans_info = randi([0,1], NRB*12*14*2, 1); % bit stream
data = qammod(reshape(trans_info, 2, NRB*12*14), 4,'gray','InputType','bit').'; % 4QAM
data = reshape(data, NRB*12, 14);
[txwaveform,info] = nrOFDMModulate(carrier,data);
[rxwaveform, pathGains, sampleTimes] = tdl(txwaveform);
y1 = nrOFDMDemodulate(carrier, rxwaveform); % receive signal
pathFilters = getPathFilters(tdl);
offset = 0;
hest = nrPerfectChannelEstimate(pathGains,pathFilters,NRB,SCS,nSlot,offset,sampleTimes);
y2 = hest.*data;
norm(y2-y1)
ans = 3.0141e-04
If tdl.MaximumDopplerShift = 0, then y2 = y1.
As `tdl.MaximumDopplerShift` increases, due to the loss of orthogonality among OFDM subcarriers, y2 will show significant deviation.
Now, I wish to construct a matrix G such that rxwaveform = G * txwaveform. Then, through the Fourier transform, we can obtain matrix H so that y = H * data. And H is commonly referred to as the effective channel matrix
I hope I have made my question clear, thank you!

Answers (1)

Abhimenyu
Abhimenyu on 5 Nov 2024 at 12:07
Edited: Abhimenyu on 5 Nov 2024 at 12:08
Hi Xinhua,
The channel matrix (G) can be constructed using the path gains and the path filters. Each element of (G) represents the channel’s impulse response at a specific delay and Doppler shift. The channel matrix (G) can be constructed by convolving the transmitted waveform with the impulse response of the channel, which is derived from the pathGains and pathFilters as given by this below-mentioned example MATLAB code:
% Assuming pathGains and pathFilters are obtained from the TDL channel
numPaths = size(pathGains, 2);
numSamples = length(txwaveform);
G = zeros(numSamples, numSamples);
  • For each path, multiply the path gain by the corresponding path filter and accumulate these contributions.
  • The circshift function is used to align the impulse response correctly for each sample index.
for pathIdx = 1:numPaths
% Get the impulse response for the current path
pathImpulseResponse = pathFilters(:, pathIdx);
% Convolve the transmitted waveform with the path's impulse response
for sampleIdx = 1:numSamples
% Ensure the impulse response is correctly aligned
impulseResponseShifted = circshift(pathImpulseResponse, sampleIdx - 1);
% Adjust the size of the impulse response to match the number of samples
if length(impulseResponseShifted) < numSamples
impulseResponseShifted = [impulseResponseShifted; zeros(numSamples - length(impulseResponseShifted), 1)];
else
impulseResponseShifted = impulseResponseShifted(1:numSamples);
end
% Update the channel matrix G
G(:, sampleIdx) = G(:, sampleIdx) + pathGains(sampleIdx, pathIdx) * impulseResponseShifted;
end
end
  • Once you have the time-domain channel matrix ( G ), you can transform it to the frequency domain using the Fourier Transform. This yields the frequency-domain channel matrix ( H ).
% Verify rxwaveform
rxwaveform_est = G * txwaveform;
% Perform the Fourier transform on the channel matrix G
H = fft(G, [], 2);
% Verify dimensions
size_H = size(H);
size_data = size(data);
disp(['Size of H: ', num2str(size_H)]);
Size of H: 7680 7680
disp(['Size of data: ', num2str(size_data)]);
Size of data: 300 14
% Adjust the number of subcarriers to match the data size
numSubcarriers = size_data(1);
numSymbols = size_data(2);
% Ensure the total number of elements remains the same
totalElements = numel(data);
% Reshape data to match the number of subcarriers and symbols
data_reshaped = reshape(data, numSubcarriers, numSymbols);
% Perform the multiplication
y_est = H(1:numSubcarriers, 1:numSubcarriers) * data_reshaped;
I hope this helps you to construct the effective channel matrix in the case of time-varying channels!

Categories

Find more on Propagation and Channel Models in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!