主要内容

isTransmitting

Status of transmission running in background

Since R2026a

Description

Add-On Required: This feature requires the Communications Toolbox Support Package for USRP Radio add-on.

status = isTransmitting(tx) returns a logical value status indicating whether the specified comm.SDRuTransmitter System object™ tx is transmitting in the background.

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 a comm.SDRuTransmitter System object.

Output Arguments

collapse all

Background transmission status, returned as a 1 (true) or 0 (false).

Data Types: logical

Version History

Introduced in R2026a

See Also

Objects

Functions