Main Content

Transmit Waveform

This example shows how to configure a software-defined radio (SDR) as a baseband transmitter to transmit a custom generated wireless waveform.

Set Up Radio

Call the radioConfigurations function. The function returns all available radio setup configurations that you saved using the Radio Setup wizard. For more information, see Connect and Set Up NI USRP Radios.

savedRadioConfigurations = radioConfigurations;

To update the dropdown menu with your saved radio setup configuration names, click Update. Then select the radio to use with this example.

savedRadioConfigurationNames = [string({savedRadioConfigurations.Name})];
radio = savedRadioConfigurationNames(1) ;

Specify Wireless Waveform

Use the attached QAM-4-GeneratedWaveform.mat file to specify the transmit waveform. The waveStruct structure in this file contains a QAM-4 waveform that is generated by using the Wireless Waveform Generator app.


Configure Baseband Transmitter

Create a baseband transmitter object with the specified radio. Because the object requires exclusive access to radio hardware resources, before running this example for the first time, clear any other object associated with the specified radio. In subsequent runs, to speed up the execution time of the example, reuse your new workspace object.

if ~exist("bbtx","var")
    bbtx = basebandTransmitter(radio);

Configure the baseband transmitter object according to the parameters of the wireless waveform.

  • Set the SampleRate property to the sample rate of the generated waveform.

  • Set the CenterFrequency property to a value in the frequency spectrum indicating the position of the waveform transmission.

bbtx.SampleRate = waveStruct.Fs;
bbtx.CenterFrequency = 2.4e9;

Set the RadioGain property according to the local wireless channel. Specify the transmit antennas.

bbtx.RadioGain = 30;

To update the dropdown menu with the antennas available for your radio, call the hTransmitAntennas helper function. Then select the antenna to use with this example.

antennaSelection = hTransmitAntennas(radio);
bbtx.Antennas = antennaSelection(1);

Plot Wireless Waveform

Plot the first hundred samples of the wireless waveform.

waveform = waveStruct.waveform;
subplot(2,1,1); plot(real(double(waveform(1:100))));
title("Real Part of Waveform")
xlabel("Samples"); ylabel("Amplitude");
subplot(2,1,2); plot(imag(double(waveform(1:100))),color='r');
title("Imaginary Part of Waveform")
xlabel("Samples"); ylabel("Amplitude");

Transmit Wireless Waveform

Call the transmit function on the baseband transmitter object. Specify the type of transmission.


End Transmission

To end a continuous transmission, call the stopTransmission function on the baseband transmitter object.


See Also



Related Topics