Uncategorized

Function and use of “Subtract” block in GNU Radio

Good question — the Subtract block in GNU Radio Companion works on streamed numeric sample data, and the type of data it processes depends on what version of the block you choose.


🧮 Supported Data Types

The Subtract block is a basic arithmetic block and has variants for:

  • Float (float) — most commonly used for real-valued signals
  • Complex (complex) — for I/Q data streams (e.g., from SDR)
  • Integer (int)
  • Short (short)

You choose the data type when inserting or configuring the block in GRC.


📈 What the Block Actually Does

If you feed it two streams, in0 and in1, the block outputs:
[
\text{out}(n) = \text{in0}(n) – \text{in1}(n)
]

  • For float: simple subtraction of scalar sample values.
  • For complex: complex subtraction, i.e. both I and Q components are subtracted.
  • For int/short: integer subtraction (beware of overflow if you’re working near the limits of the data type).

The operation happens sample by sample, in lockstep. So both input streams must:

  • have the same item type
  • be sample-synchronous (same sample rate and timing alignment).

🧠 Typical Use Cases

  • Interferometry: subtracting one antenna channel from another to isolate correlated signal.
  • Noise cancellation: subtract reference noise or interference.
  • DC offset removal (in combination with other blocks).
  • Differential signal processing.

⚠️ Important Considerations

  • If one stream is delayed relative to the other, subtraction will not cancel properly — you may need a delay block to align them first.
  • The block does not do automatic scaling or resampling. Both inputs must match in rate and length.
  • It processes continuous streams, not message or vector bursts.

Summary:
The Subtract block in GNU Radio works on sample streams of type float, complex, int, or short, performing sample-by-sample subtraction between two inputs. Most SDR signal processing uses either float or complex versions.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.