Main Content

plotDetectionSignals

Plot energy detection signals for triggering

Since R2023b

Description

example

plotDetectionSignals(ed,length) plots the energy detection signals while detecting live data of length length from the air using the energy detector ed. The plot shows the integrated signal energy, the energy delta in dB between adjacent integration windows, the thresholds, and trigger points of the detection. Use the displayed information to calibrate the thresholds of the energy detector for triggering.

droppedSamples = plotDetectionSignals(ed,length) returns the status information of dropped samples, in addition to plotting preamble detection signals.

Examples

collapse all

Create and configure an energy detector object, specifying a radio setup configuration previously saved in the Radio Setup wizard.

ed = energyDetector("MyRadio")
ed = 
  energyDetector with properties:

                Antennas: "RF0:RX2"
         CenterFrequency: 2.4000e+09
              SampleRate: 250000000
               RadioGain: 10
         CaptureDataType: "int16"
            WindowLength: 300
           TriggerOffset: 0
    DroppedSamplesAction: "error"
         ThresholdMethod: "adaptive"
           MinimumEnergy: 1.0000e-04
    EnergyDeltaThreshold: 1

ed.SampleRate = 30.72e6;
ed.CenterFrequency = 2.45e9;
ed.RadioGain = 30;

Set the energy increase threshold to 20 dB and the minimum energy to 0.1.

ed.EnergyDeltaThreshold = 20;
ed.MinimumEnergy = 0.1;

Generate a test waveform for detection.

chirpSignal = single(chirp(0:1/1e3:2,0,0.5,15,'complex')).';
chirpSignal(end) = [];
PadLen = 6500;
zeroSignal = complex(zeros(PadLen,1),zeros(PadLen,1));
testWaveform = [zeroSignal; chirpSignal*0.999; zeroSignal];

Send the test waveform continuously.

transmit(ed,testWaveform,"continuous", ...
    TransmitGain=30);
Loading bitstream to FPGA...
Loading bitstream to FPGA is now complete.

Plot the specified number of samples of the signal energy. Use the displayed information to calibrate the thresholding parameters.

plotDetectionSignals(ed,50000);

Input Arguments

collapse all

Energy detector, specified as an energyDetector object.

Note

The first object function call in which you specify this object as an input requires a few extra seconds to load the application onto the hardware.

Plotted data length, specified as an integer number of samples or a duration value in time units. The function converts length into N samples based on the ed.SampleRate property and plots ceil(N) number of data samples.

Specify the plotted data length relative to the onboard radio memory buffer size.

Radio DeviceMemory Buffer SizeMaximum Data Samples

USRP™ N310

2 GB229

USRP N320

2 GB229

USRP N321

2 GB229

USRP X310

1 GB228

USRP X410

4 GB230

Note

The onboard radio memory buffers plotted and transmit data samples. Therefore, when specifying the plotted data length, you must also account for the length of the transmit waveform of any continuous transmission that you specify when calling the transmit object function with the ed input.

Example: seconds(5)

Data Types: double | duration

Output Arguments

collapse all

Status of dropped samples, returned as one of these logical values.

  • 1 — Samples are dropped while plotting the signals.

  • 0 — Samples are not dropped while plotting the signals.

Use the DroppedSamplesAction property of the ed input to specify the behavior of the plotDetectionSignals function upon dropped samples.

Data Types: logical

Version History

Introduced in R2023b

See Also

Objects

Functions