|
### 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
- 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.
- 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.
matlab-agentic-toolkit/skills-catalog/wireless-communications/matlab-add-awgn/SKILL.md
Line 182 in 3c3a253
## 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
awgnon an OFDM waveform when the target SNR is per-subcarrier.Without this, an agent falls back to Rule 1's non-unit-power pattern:
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:
Suggested fix
Add AWGN in an OFDM link simulation (per-subcarrier SNR)
In OFDM link simulations, SNR is defined per subcarrier. Use
convertSNRto get the wideband SNR, then pass it toawgnwiththe actual OFDM signal power:
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:
Do NOT compute received waveform power — that gives wideband SNR, not
per-subcarrier SNR.
For adding noise directly in a link simulation, see the "Add AWGN in an OFDM link simulation" pattern — use
convertSNRwithawgn, 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.