メインコンテンツ

transmitRepeat

Transmit waveform repeatedly in the background

Since R2026a

Description

Add-On Required: This feature requires the Communications Toolbox Support Package for USRP Radio 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="B210",SerialNum='3136D5F',...
                   CenterFrequency=2e9,MasterClockRate=50e6,...
                   Gain=30);
tx.InterpolationFactor = tx.MasterClockRate/sampleRate;

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

rx = comm.SDRuReceiver(Platform="B210",SerialNum='3136D5F',...
                CenterFrequency=2e9,MasterClockRate=50e6,...
                Gain=45);
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 timescope and spectrum analyzer for visualization at the receiver.

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

Transmit the sine wave in the background using the transmitRepeat function.

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. Use the isTransmitting function to check if the transmitter is transmitting in the background.

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

Stop the background transmission and release the transmitter and receiver System objects.

stopTransmission(tx);
disp('Transmission ended')
Transmission ended
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

See Also

Objects

Functions