Main Content

5G NR Waveform Generation

This example provides an overview of 5G NR waveform generation workflows and the waveform types that you can generate using the 5G Toolbox™ product.

Introduction

Using 5G Toolbox features, you can configure and generate these NR waveforms.

  • NR test models (NR-TM)

  • NR uplink and downlink fixed reference channels (FRCs)

  • NR downlink waveforms

  • NR uplink waveforms

To configure and generate a waveform with a static set of parameters, you can use either of these workflows. You can use the waveforms generated with these workflows in test and measurement applications.

  • Use the 5G Waveform Generator app, which provides a user interface (UI) to configure the waveform. Because 5G waveforms have a large number of parameters, the recommended workflow for parameterizing a waveform is to use this app. The app enables you to generate the waveform directly in the app or to export the waveform configuration to MATLAB® to generate the waveform at the command prompt. The app also enables you to export the waveform configuration to Simulink™.

  • Use the nrWaveformGenerator function, which provides a programmatic interface to configure the waveform using a configuration object.

To learn how to configure and generate waveforms with dynamically changing parameters (for example, when modeling a 5G link) see the NR PDSCH Throughput and NR PUSCH Throughput examples.

To learn how to configure and generate physical random access channel (PRACH) waveforms, see the 5G NR PRACH Configuration and 5G NR PRACH Waveform Generation examples.

Configure and Generate 5G Waveforms Using the App

The 5G Waveform Generator app provides a UI to manage the large number of configuration parameters. In the app, you can choose the waveform type, specify the parameters, and generate and export the waveform. The app also enables you to interact with test and measurement equipment. This figure shows a common workflow to generate and export a 5G waveform in this app.

WaveformGenerationSteps.png

Open 5G Waveform Generator App

Open the 5G Waveform Generator app by clicking the app icon on the Apps tab, under Signal Processing and Communications.

Choose Waveform Type

In the app, you can select different waveform types. The downlink and uplink options enable you to fully customize the contents of your waveform. You can also generate NR-TMs, downlink FRCs, and uplink FRCs.

Specify Parameters

In the app, you can specify the parameters. When you set the parameters, the app updates the resource grid visualization content instantly, showing the location of all physical channels in the waveform. The resource grid view contains a union of the locations of all physical channels over all ports (that is, the visualization does not differentiate what each port transmits). Because the maximum resolution of the resource grid is one resource block (RB), the visualization does not show signals using single resource elements (REs).

This figure shows the configuration of two physical downlink shared channels (PDSCHs). The first PDSCH spans all slots and uses physical resource blocks (PRBs) 0 to 100. The second PDSCH is active in slots 0 to 2 and 4 to 6 and uses PRBs 200 to 250.

Generate Waveform

To generate the configured waveform in the app, click Generate. The app creates the baseband in-phase and quadrature (IQ) component samples internally in the generator. You can see the spectrum of the generated signal in the Spectrum Analyzer tab.

Export Waveform

To export the waveform, click Export and select one of the available options. You can export the waveform to the workspace, a file, a MATLAB script, or a Simulink model.

  • The Export to Workspace option creates a structure in the MATLAB workspace. The structure contains the waveform samples, sampling frequency, configuration parameters, and a string describing the waveform type (downlink, uplink, test model, downlink FRC, or uplink FRC). For example:

myWaveformStructure.png

  • The Export to File option saves the waveform as a .mat or a .bb baseband file.

  • The Export to MATLAB Script option creates a MATLAB script. Run the script to generate the configured waveform at the MATLAB command window.

  • The Export to Simulink option generates a Waveform From Wireless Waveform Generator App block. Use the block as a waveform source in a Simulink model.

Configure and Generate 5G Waveforms Using MATLAB Code

The nrWaveformGenerator function provides a programmatic interface to configure the waveform using a configuration object. Instead of specifying all parameters manually, which is time consuming, you can configure the waveform in the 5G Waveform Generator app and export this configuration to a MATLAB script. You can modify and run this MATLAB script to generate the configured 5G waveform.

Using the app has these benefits.

  • The app includes UI controls, such as drop-down lists to select values.

  • Some UI controls include validation when you set custom values.

  • The grid visualization capability enables you to see what the signal looks like as you specify the parameters.

For example, the code example in this section generates a 5G downlink waveform using the nrDLCarrierConfig configuration object. The code that you generate for a downlink waveform using the Export to MATLAB Script option in the app also uses the nrDLCarrierConfig configuration object.

Create a default downlink waveform configuration object. The waveconfig object contains the full waveform specification and is fully configurable.

waveconfig = nrDLCarrierConfig
waveconfig = 
  nrDLCarrierConfig with properties:

               Label: 'Downlink carrier 1'
      FrequencyRange: 'FR1'
    ChannelBandwidth: 50
             NCellID: 1
        NumSubframes: 10
    InitialNSubframe: 0
    WindowingPercent: 0
          SampleRate: []
    CarrierFrequency: 0
         SCSCarriers: {[1x1 nrSCSCarrierConfig]}
      BandwidthParts: {[1x1 nrWavegenBWPConfig]}
             SSBurst: [1x1 nrWavegenSSBurstConfig]
             CORESET: {[1x1 nrCORESETConfig]}
        SearchSpaces: {[1x1 nrSearchSpaceConfig]}
               PDCCH: {[1x1 nrWavegenPDCCHConfig]}
               PDSCH: {[1x1 nrWavegenPDSCHConfig]}
               CSIRS: {[1x1 nrWavegenCSIRSConfig]}

After you set the configuration parameters, call the programmatic waveform generator.

[waveform,waveformInfo] = nrWaveformGenerator(waveconfig);

Plot the spectrogram to visualise the signal in the frequency domain. This waveform includes a full allocation PDSCH, a physical downlink control channel (PDCCH), and the signal synchronization (SS) burst.

% Plot spectrogram of waveform for first antenna port
samplerate = waveformInfo.ResourceGrids(1).Info.SampleRate;
nfft = waveformInfo.ResourceGrids(1).Info.Nfft;
figure;
spectrogram(waveform(:,1),ones(nfft,1),0,nfft,'centered',samplerate,'yaxis','MinThreshold',-130);
title('Spectrogram of 5G Downlink Baseband Waveform');

Figure contains an axes object. The axes object with title Spectrogram of 5G Downlink Baseband Waveform, xlabel Time (ms), ylabel Frequency (MHz) contains an object of type image.

Change the PDSCH allocation to span PRBs 0 to 10. Generate the waveform and plot the spectrogram.

waveconfig.PDSCH{1}.PRBSet = 0:10;
[waveform,waveformInfo] = nrWaveformGenerator(waveconfig);

% Plot spectrogram of waveform for first antenna port
samplerate = waveformInfo.ResourceGrids(1).Info.SampleRate;
nfft = waveformInfo.ResourceGrids(1).Info.Nfft;
figure;
spectrogram(waveform(:,1),ones(nfft,1),0,nfft,'centered',samplerate,'yaxis','MinThreshold',-130);
title('Spectrogram of 5G Downlink Baseband Waveform');

Figure contains an axes object. The axes object with title Spectrogram of 5G Downlink Baseband Waveform, xlabel Time (ms), ylabel Frequency (MHz) contains an object of type image.

You can define multiple instances of the physical channels and signals. Create a second instance of the PDSCH configuration object and set the allocation to span PRBs 40 to 50 and OFDM symbols 2 to 10.

mySecondPDSCH = nrWavegenPDSCHConfig;
mySecondPDSCH.PRBSet = 40:50;
mySecondPDSCH.SymbolAllocation = [2 10];

Assign the second PDSCH configuration to the waveform configuration. Generate the waveform.

waveconfig.PDSCH{2} = mySecondPDSCH;
[waveform,waveformInfo] = nrWaveformGenerator(waveconfig);

% Plot spectrogram of waveform for first antenna port
samplerate = waveformInfo.ResourceGrids(1).Info.SampleRate;
nfft = waveformInfo.ResourceGrids(1).Info.Nfft;
figure;
spectrogram(waveform(:,1),ones(nfft,1),0,nfft,'centered',samplerate,'yaxis','MinThreshold',-130);
title('Spectrogram of 5G Downlink Baseband Waveform');

Figure contains an axes object. The axes object with title Spectrogram of 5G Downlink Baseband Waveform, xlabel Time (ms), ylabel Frequency (MHz) contains an object of type image.

Related Topics