Skip to content

AWGN skill: missing pattern for adding noise in OFDM link simulations #45

Description

@clopez-mw

### OFDM conversion: Eb/No → per-subcarrier SNR → wideband SNR

## AWGN skill: missing pattern for adding noise in OFDM link simulations

Problem**

The skill correctly explains how to convert between wideband SNR and per-subcarrier SNR (Rule 4, "OFDM conversion"
pattern), but never shows how to actually call awgn on an OFDM waveform when the target SNR is per-subcarrier.

Without this, an agent falls back to Rule 1's non-unit-power pattern:

  sigPow = mean(abs(rxWaveform).^2);
  rxNoisy = awgn(rxWaveform, snrdB, 10*log10(sigPow));

This gives wideband SNR — not per-subcarrier SNR — which is incorrect for OFDM link simulations where performance is
measured per RE.

Observed behavior

When asked to build a 5G NR PDSCH link simulation, the agent produced the wideband-SNR pattern above, mislabeling the
x-axis as "SNR per RE."

Expected behavior

The agent should use convertSNR to obtain the wideband SNR and pass it to awgn with the correct signal power:

snrWb = convertSNR(snrPerSC_dB, "snrsc", "snr", ...
      FFTLength=nfft, NumActiveSubcarriers=numActiveSC);
  sigPow = 10*log10(numActiveSC / nfft^2);
  rxNoisy = awgn(rxWaveform, snrWb, sigPow);

Suggested fix

  1. Add a pattern after "OFDM conversion: Eb/No → per-subcarrier SNR → wideband SNR":

Add AWGN in an OFDM link simulation (per-subcarrier SNR)

In OFDM link simulations, SNR is defined per subcarrier. Use
convertSNR to get the wideband SNR, then pass it to awgn with
the actual OFDM signal power:

snrWb = convertSNR(snrPerSC_dB, "snrsc", "snr", ...
    FFTLength=nfft, NumActiveSubcarriers=numActiveSC);
sigPow = 10*log10(numActiveSC / nfft^2);
rxNoisy = awgn(rxWaveform, snrWb, sigPow);

However, that's a difficult pattern because it requires knowing the number of active subcarriers, which is confusing (allocated vs unallocated). Alternatively, the skill could use the equivalent shortcut that avoids needing to know the "active" subcarriers:

rxNoisy = awgn(rxWaveform, snrPerSC_dB, -10*log10(double(nfft)));

Do NOT compute received waveform power — that gives wideband SNR, not
per-subcarrier SNR.

  1. Append to Rule 4 a sentence connecting conversion to action:

For adding noise directly in a link simulation, see the "Add AWGN in an OFDM link simulation" pattern — use
convertSNR with awgn, or pass -10*log10(Nfft) as signal power.

Why this matters

Rule 4 stops at the math. The agent needs to know what to do with awgn — not just how to convert between SNR
definitions. The gap between "here's how to convert" and "here's how to call awgn" is where the error occurs.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions