メインコンテンツ

transmitRepeat

Transmit waveform repeatedly in the background

Since R2026a

Description

Add-On Required: This feature requires the Wireless Testbench Support Package for NI USRP Radios add-on.

transmitRepeat(tx,data) transmits the waveform data repeatedly in the background using the transmitter System object™ tx, until you stop the transmission by calling stopTransmission(tx).

example

Examples

collapse all

Create and initialize the transmitter System object. Set the interpolation factor.

sampleRate = 1e6;
tx = comm.SDRuTransmitter(Platform="X310",IPAddress='192.168.40.2',...
    CenterFrequency=2e9,Gain=20);
tx.InterpolationFactor = tx.MasterClockRate/sampleRate;

Create and initialize the receiver System object. Set the decimation factor.

rx = comm.SDRuReceiver(Platform="X310",IPAddress='192.168.40.2',...
    CenterFrequency=2e9,Gain=20);
rx.DecimationFactor = rx.MasterClockRate/sampleRate;

Generate a sine wave for transmission.

sinewave = dsp.SineWave(1,50e3);
sinewave.SampleRate = sampleRate;
sinewave.SamplesPerFrame = 2e4;
sinewave.OutputDataType = 'double';
sinewave.ComplexOutput = true;
txData = sinewave();

Initialize the time scope and spectrum analyzer for visualization.

timeScope = timescope(SampleRate=sampleRate);
spectrumScope = spectrumAnalyzer(SampleRate=sampleRate, ...
ViewType="spectrum");
spectrumScope.PeakFinder.Enabled = true;

Use the transmitRepeat function to transmit the sine wave in the background.

samplePerFrame = 2e4;
stopTime = 1;
transmitRepeat(tx,txData);
## Waveform transmission has started successfully and will repeat indefinitely. Call the stopTransmission() method to stop the transmission.
pause(10)
disp('Transmission started')
Transmission started

Receive the sine wave in the foreground using the receiver System object. Use the isTransmitting function to check if transmission is ongoing. Visualize the received data using the time scope and spectrum analyzer.

if isTransmitting(tx)
    for i = 1:40
        [data, ~] = rx(); 
timeScope(data)
spectrumScope(data)
    end
end

Stop the background transmission.

stopTransmission(tx);
disp('Transmission ended')
Transmission ended

Release the transmitter and receiver System objects.

release(tx);
release(rx);

Input Arguments

collapse all

Transmitter System object, specified as comm.SDRuTransmitter object.

Signal to transmit, specified as one of these options:

  • Complex column vector — For as single channel radio, specify the signal to transmit as a complex column vector.

  • Complex matrix — For multi-channel radios or bundled radios, specify the signal to transmit as a complex matrix with the number of columns equal to the number of channels specified in the ChannelMapping property of the comm.SDRuReceiver object. Each column in this matrix corresponds to complex data sent on one channel. The complex data in the transmitted signal must be one of these data types:

    • 16-bit signed integers — Specify complex values in the range [-32768 32767].

    • Single-precision floating point — Specify complex values in the range [-1 1].

    • Double-precision floating point — Specify complex values in the range [-1 1].

Data Types: int16 | single | double

Version History

Introduced in R2026a