MATLAB: How to modify the PUSCH slot allocation for the hNRReferen​ceWaveform​Generator object provided in the “5G NR-TM and FRC Waveform Generation” reference example

I am using the reference example "5G NR-TM and FRC Waveform Generation" which provides the hNRReferenceWaveformGenerator class for generating a waveform. How can I control which slots get used for the PUSCH part of the waveform?

Best Answer

The first thing to note is that the "hNRReferenceWaveformGenerator" class is using the documented objects "nrULCarrierConfig" and "nrWaveformGenerator" under the hood. 
You can see that from line 389 of hNRReferenceWaveformGenerator.m:
>> [wave,winfo] = nrWaveformGenerator(cv);
and by looking at the "Config" property of hNRReferenceWaveformGenerator:
>> ulrefwavegen = hNRReferenceWaveformGenerator(ulnrref,bw,scs,dm,ncellid);
>> ulrefwavegen.Config
The "nrULCarrierConfig" has a PUSCH configuration that you can set:
>> ulrefwavegen.Config.PUSCH{1}
which is an object of type "nrWavegenPUSCHConfig". You will notice that the "nrWavegenPUSCHConfig" object lets you specify the "SlotAllocation":
>> ulrefwavegen.Config.PUSCH{1}.SlotAllocation
The "SlotAllocation" property lets you specify where you want to put the PUSCH. Here is how to do that using the "hNRReferenceWaveformGenerator" class from the example:
bw = 100;
scs = 120;
dm = 'TDD';
ncellid = 1;
ulnrref = 'G-FR2-A4-9';
ulrefwavegen = hNRReferenceWaveformGenerator(ulnrref,bw,scs,dm,ncellid);
% this line lets you modify properties in ulrefwavegen
ulrefwavegen = ulrefwavegen.makeConfigWritable;
% specify a vector indicating what slots to put the PUSCH signal in
ulrefwavegen.Config.PUSCH{1}.SlotAllocation = 4:5:80;
% now you can generate a waveform
[ulrefwaveform,ulrefwaveinfo,ulresourceinfo] = generateWaveform(ulrefwavegen);