Main Content

Transmit Waveform

This example shows how to use a software-defined radio (SDR) 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.

radios = radioConfigurations;

Specify the name of a saved radio setup configuration to use with this example.

radioName = radios(1).Name;

Specify Wireless Waveform

Use the attached QAM-4-GeneratedWaveform.mat file to specify the transmit waveform. The waveStruct structure 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. To speed up the execution time of this example upon subsequent runs, reuse the workspace object from the first run of the example.

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

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 = 10;
bbtx.Antennas = "RF0:TX/RX";

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