Skip to content

matlab/matlab-agentic-toolkit / skills-catalog/wireless-communications/matlab-add-awgn

matlab-add-awgn

Verified

Read BEFORE writing any code that adds Additive White Gaussian Noise (AWGN) to signals and converts between SNR, Eb/No, Es/No, and per-subcarrier SNR for communications simulations, using awgn(), convertSNR(), berawgn(). The default MATLAB patterns for AWGN (e.g., 'measured' option, manual SNR formulas) produce subtly incorrect results. This skill specifies the correct calling conventions, required function usage, and critical anti-patterns that must be avoided.

FileKindSize
SKILL.mdskill md14.6 KB
manifest.yamlconfig501 B
references/5g-link-noise.mdmarkdown2.3 KB
references/snr-conversion-guide.mdmarkdown8.4 KB

references/5g-link-noise.md

View on GitHub
# 5G Link Noise: Noise Variance for the Receiver

5G Toolbox specific. Covers adding AWGN at a per-subcarrier SNR to a 5G
downlink waveform and deriving the noise variance the frequency-domain
receiver needs for MMSE equalization and PDSCH decoding.

## Adding noise at a per-subcarrier SNR

`nrTDLChannel` and `nrCDLChannel` default to `NormalizeChannelOutputs=true`,
which divides the channel output power by the number of receive antennas.
Match the noise scaling used in the shipped 5G examples:

    SNR = 10^(snrPerSC_dB/10);
    N0  = 1/sqrt(nRxAnts*nfft*SNR);
    rxNoisy = rxWaveform + N0*randn(size(rxWaveform), "like", rxWaveform);

If `NormalizeChannelOutputs=false`, drop the `nRxAnts` factor:
`N0 = 1/sqrt(nfft*SNR)`.

The `"like"` draws complex noise at the correct variance; without it, `randn`
returns real-only noise and halves the noise power. `nfft` is the OFDM FFT
length (`nrOFDMInfo` reports it as `Nfft`).

The same noise level can be added with `awgn` using the analytical signal
power (identical result), which also avoids computing the active subcarrier
count:

    % NormalizeChannelOutputs=true (default)
    rxNoisy = awgn(rxWaveform, snrPerSC_dB, -10*log10(double(nfft*nRxAnts)));

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

These forms assume unit-power subcarrier symbols (e.g.,
`qammod(..., UnitAveragePower=true)`). If the modulator uses default
constellation scaling, the analytical signal power is
`numAvailableSC * meanSymbolPower / nfft^2` with
`meanSymbolPower = mean(abs(symbols).^2)`.

## Noise variance for the equalizer and demodulator

The equalizer and the PDSCH decoder operate on the frequency-domain grid,
after `nrOFDMDemodulate`. The FFT scales the time-domain noise variance
(`N0^2`) by `nfft`, so the frequency-domain noise variance is:

    nVar = N0^2 * nfft;

Pass `nVar` as the last argument to both the equalizer and the demodulator:

    nrEqualizeMMSE(___,nVar)
    nrPDSCHDecode(___,nVar)

This is the frequency-domain counterpart of the generic soft-demod rule in
SKILL.md ("scale the time-domain noise variance by `nfft`"). Keep the same
`N0` throughout so the noise added to the waveform and the `nVar` fed to the
receiver stay consistent.

Copyright 2026 The MathWorks, Inc.
reverse-engineer-anythingmorluto/reaReverse engineer native, managed, Electron/JavaScript, packaged, firmware, and browser targets with REA, and build agent environments (AgentEnv bundles) of web applications from a live instance or a capture, and of Linux desktop apps with a task from a request. Use shipped-artifact or requested runtime evidence to explain features, compare versions, decompile code, or guide a reconstruction. Skip REA for ordinary source-repository architecture analysis.Stars: 472kUpdated Claude CodeCodexVerifiedInstall
diagnosing-superpowersobra/superpowersUse when a superpowers session went wrong and your human partner wants to know why — repeated work, ignored plans, stumbles, poor results, a skill that didn't fire, "it took too long", "why is it so expensive", "what is it doing" — or wants to build a bug report for the superpowers maintainers, for the current session or a past one identified by id or path, on any harness.Stars: 322kUpdated Claude CodeCodexVerifiedInstall
dispatching-parallel-agentsobra/superpowersUse when facing 2+ independent tasks that can be worked on without shared state or sequential dependenciesStars: 322kUpdated Claude CodeCodexVerifiedInstall
executing-plansobra/superpowersUse when executing an implementation plan in the current session as the implementer yourself — your human partner chose inline execution, or no subagent tool is availableStars: 322kUpdated Claude CodeCodexVerifiedInstall