Main Content

Wireless Waveform Generator

Create, impair, visualize, and export modulated waveforms

Description

The Wireless Waveform Generator app enables you to create, impair, visualize, and export modulated waveforms.

Using the app, you can:

  • Generate custom OFDM, QAM, and PSK modulated waveforms.

  • Generate sine wave test waveforms.

  • Generate 5G NR uplink and downlink carrier waveforms. This feature requires 5G Toolbox. For more information, see the 5G Waveform Generator (5G Toolbox) app reference page.

  • Generate LTE modulated waveforms. This feature requires the LTE Toolbox. For more information, see the LTE Waveform Generator (LTE Toolbox) app reference page.

  • Generate WLAN (802.11™) modulated waveforms. This feature requires the WLAN Toolbox. For more information, see the WLAN Waveform Generator (WLAN Toolbox) app reference page.

  • Generate Bluetooth modulated waveforms. To use this functionality, download and install the Communications Toolbox Library for the Bluetooth Protocol add-on.

  • Export the waveform to your workspace or to a .mat or a .bb file.

  • Export waveform generation parameters to a runnable MATLAB® script or a Simulink® block.

    • Use the exported script to generate your waveform without the app from the command line.

    • Use the exported block as a waveform source in a Simulink model. For more information, see Waveform From Wireless Waveform Generator App.

  • Visualize the waveform in constellation diagram, spectrum analyzer, OFDM grid, and time scope plots.

  • Distort the waveform by adding RF impairments, such as AWGN, phase offset, frequency offset, DC offset, IQ imbalance, and memoryless cubic nonlinearity.

  • Generate a waveform that you can transmit using a connected lab test instrument. The app can transmit a waveform by using instruments supported by the rfsiggen (Instrument Control Toolbox) function. Use of the transmit feature in the app requires Instrument Control Toolbox™ software. For more information, see the documentation for Instrument Control Toolbox.

For more information, see Use Wireless Waveform Generator App.

Wireless Waveform Generator app display of 16QAM waveform with IQ imbalance and RRC filtering.

Open the Wireless Waveform Generator App

MATLAB Toolstrip: On the Apps tab, under Signal Processing and Communications, click the app icon.

MATLAB Command Prompt: Enter wirelessWaveformGenerator.

Examples

expand all

Open the Wireless Waveform Generator app and generate the default waveform by clicking Generate. The displayed waveform is an OFDM waveform with QPSK-modulated symbols.

Wireless Waveform Generator app display of OFDM waveform for default configuration.

Click Insert DC null and increase the Guard band subcarriers to [20;19]. Click Generate again. The plotted waveform changes to reflect the updated configuration.

Wireless Waveform Generator app display of OFDM waveform with DC null and guard band subcarriers set to [20;19].

Open the Wireless Waveform Generator app and configure a 16-QAM waveform. Specify a phase imbalance of 11.25 degrees (pi/16 radians) and an amplitude imbalance of 1.5 dB. Click Generate to generate the waveform.

Wireless Waveform Generator app display of 16QAM waveform with IQ imbalance.

Select the Filtering parameter and apply root raised cosine filtering. Click Generate again to generate a waveform using the current configuration. The plotted waveform changes to reflect the updated configuration.

Wireless Waveform Generator app display of 16QAM waveform with IQ imbalance and RRC filtering.

This example shows how you can generate 5G NR waveforms. For more information, see the 5G Waveform Generator (5G Toolbox) app reference page.

Open 5G Waveform Generator App

On the Apps tab of the MATLAB toolstrip, under Signal Processing and Communications, click the 5G Waveform Generator app icon. This app opens the Wireless Waveform Generator app configured for 5G waveform generation. This feature requires 5G Toolbox.

Generate 5G NR Waveform

This image shows the visualization results for 5G downlink waveform generation using default parameters.

5G Wireless Waveform Generator app default configuration.

This example shows how you can generate LTE waveforms. For more information, see the LTE Waveform Generator (LTE Toolbox) app reference page.

Open LTE Waveform Generator App

On the Apps tab of the MATLAB toolstrip, under Signal Processing and Communications, click the LTE Waveform Generator app icon. This app opens the Wireless Waveform Generator app configured for LTE waveform generation. This feature requires the LTE Toolbox.

Generate LTE Waveform

This image shows the visualization results for LTE downlink waveform generation using default parameters.

LTE Wireless Waveform Generator app default configuration.

This example shows how you can generate Bluetooth® waveforms. To use the Bluetooth feature, you must download and install the Communications Toolbox Library for the Bluetooth Protocol.

On the Apps tab of the MATLAB toolstrip, under Signal Processing and Communications, click the Wireless Waveform Generator app icon. This app opens the Wireless Waveform Generator app. In the Waveform Type section, click Bluetooth Low Energy. Click Generate to generate the BLE waveform.

This image shows the visualization results for BLE downlink waveform generation using default parameters.

BLE Wireless Waveform Generator app default configuration.

This example shows how you can generate WLAN waveforms. For more information, see the WLAN Waveform Generator (WLAN Toolbox) app reference page.

Open WLAN Waveform Generator App

On the Apps tab of the MATLAB toolstrip, under Signal Processing and Communications, click the WLAN Waveform Generator app icon. This app opens the Wireless Waveform Generator app configured for WLAN waveform generation. This feature requires the WLAN Toolbox.

Generate WLAN Waveform

This image shows the visualization results for WLAN downlink waveform generation using default parameters.

WLAN Wireless Waveform Generator app default configuration.

This example shows how to configure and use the block that is generated using the Export to Simulink capability that is available in the Wireless Waveform Generator app.

Introduction

The Wireless Waveform Generator app is an interactive tool for creating, impairing, visualizing, and exporting waveforms. You can export the waveform to your workspace or to a .mat or .bb file. You can also export the waveform generation parameters to a runnable MATLAB® script or a Simulink® block. You can use the exported Simulink block to reproduce your waveform in Simulink. This example shows how to use the Export to Simulink capability of the app and how to configure the exported block to generate waveforms in Simulink.

Although this example focuses on exporting an OFDM waveform, the same process applies for all of the supported waveform types.

Export Wireless Waveform Configuration to Simulink

Open the Wireless Waveform Generator app by clicking the app icon on the Apps tab, under Signal Processing and Communications. Alternatively, enter wirelessWaveformGenerator at the MATLAB command prompt.

In the Waveform Type section, select an OFDM waveform by clicking OFDM. In the left-most pane of the app, adjust any configuration parameters for the selected waveform. Then export the configuration by clicking Export in the app toolstrip and selecting Export to Simulink.

The Export to Simulink option creates a Simulink block, which outputs the selected waveform when you run the Simulink model. The block is exported to a new model if no open models exist.

modelName = 'WWGExport2SimulinkBlock';
open_system(modelName);

The Form output after final data value by block parameter specifies the output after all of the specified signal samples are generated. The value options for this parameter are Cyclic repetition and Setting to zero. The Cyclic repetition option repeats the signal from the beginning after it reaches the last sample in the signal. The Setting to zero option generates zero-valued outputs for the duration of the simulation after generating the last frame of the signal. The Waveform sample rate (Fs) and Waveform length block parameters are derived from the waveform configuration that is available in the Initialization tab of the Mask Editor dialog box. For further information about the block parameters, see Waveform From Wireless Waveform Generator App. This figure shows the parameters of the exported block.

close_system(modelName);

Connect a Spectrum Analyzer block to the exported block.

modelName = 'WWGExport2SimulinkModel';
open_system(modelName);

Simulate the model to visualize the waveform using the current configuration.

sim(modelName);

The Spectrum Analyzer block inherits the Waveform sample rate (Fs) parameter, which is 64 MHz.

close_system(modelName);

Modify Wireless Waveform Configuration

When you run the Simulink model, the exported block outputs the waveform generated in the Initialization tab of the Mask Editor dialog box for the block. The MATLAB code that initializes the waveform in this tab corresponds to the configuration that you selected in the Wireless Waveform Generator app before exporting the block. To modify the configuration of the waveform, choose one of these options:

  • Open the Wireless Waveform Generator app, select the configuration of your choice, and export a new block. This option provides interaction with an app interface instead of MATLAB code, parameter range validation during the parameterization process, and visualization of the waveform before running the Simulink model.

  • Update the configuration parameters that are available in the Initialization tab of the Mask Editor dialog box of the exported block. This option requires modifying the MATLAB code available in this tab so that the parameter range validation occurs only when you apply the changes. This option does not provide visualization of the waveform before running the Simulink model. Modifying the waveform parameters using this option is not recommended if you are not familiar with the MATLAB code that generates the selected waveform.

If you choose to modify the configuration by using the Initialization tab, you can open it by clicking the exported block, pressing Ctrl+M to open the Mask Editor dialog, and clicking the Initialization tab.

Use the MATLAB code that is available in the Initialization tab to update the parameters of your choice. For example, set the subcarrier spacing, scs, to 1,500,000 Hz.

Click OK to apply the changes and close the Mask Editor dialog box. Simulate the model to visualize the updated waveform.

modelName = 'WWGExport2SimulinkModelSCSModified';
sim(modelName);

The Spectrum Analyzer block now shows a sample rate of 96 MHz, which is 1.5 times the previous sample rate, as expected.

Share Wireless Waveform Configuration with Other Blocks in the Model

To access read-only block parameters and waveform configuration parameters, use the UserData common block property, which is a structure with these fields.

  • WaveformConfig: Waveform configuration

  • WaveformLength: Waveform length

  • Fs: Waveform sample rate

You can access the user data of the exported block by using the get_param function.

get_param([gcs '/OFDM Waveform Generator'],'UserData')
ans = 

  struct with fields:

    WaveformConfig: [1x1 comm.OFDMModulator]
    WaveformLength: 8000
                Fs: 96000000

Store the structure available in the user data in a base workspace variable by using the InitFcn in the callback. The InitFcn callback is executed during a model update and simulation. To use this callback, click the MODELING tab, then click the Model Settings dropdown, and click the Model Properties option. In the Callbacks pane, select the InitFcn callback. Assign the user data to a new base workspace variable (for example, cfg).

The parameters that are available in the user data of the exported block are updated every time you apply configuration changes in the Initialization tab.

To demodulate the OFDM waveform, add an OFDM Demodulator block to the model. Connect an AWGN Channel block between the OFDM Waveform Generator and OFDM Demodulator blocks to add white Gaussian noise to the input signal. Also add a Constellation Diagram block to plot the demodulated symbols.

modelName = 'WWGExport2SimulinkModelWithDemod';
open_system(modelName);

The parameters that are required to configure the OFDM Demodulator block must match the parameters that are used to configure the exported block, (otherwise, demodulation fails). To access the configuration parameters of the exported block, use the variable cfg. This figure shows the parameters of the OFDM Demodulator block.

Because the OFDM Demodulator block requires the entire OFDM waveform for demodulation, set the Samples per frame parameter in the exported block to cfg.WaveformLength. Simulate the model.

sim(modelName);

After demodulating the OFDM waveform by using the OFDM Demodulator block, the Constellation Diagram block displays the resulting QAM symbols.

Generate Multicarrier Waveforms

For multicarrier generation, the sampling rates for all of the waveforms must be the same. To shift the waveforms to a carrier offset and aggregate them, you can use the Multiband Combiner block.

modelName = 'WWGExport2SimulinkMulticarrier';
open_system(modelName);

To shift the waveforms in frequency, you might have to increase the sampling rates. The Multiband Combiner block provides the option to oversample the input waveforms before shifting and combining them. This figure shows the parameters of the Multiband Combiner block.

Simulate the model to visualize the waveforms that are centered at -80, 20, and 100 MHz.

sim(modelName);

Introduced in R2018b