Matlab Design Ofdm System
MathWorksOfficialCreated by MathWorks
- Skill
- Tool integration
- Software development
- BSD-2-Clause
- No issues found
AutoGineer summary
Written by AutoGineer from the skill’s own files, not by the author
This skill provides essential patterns and anti-patterns for building custom OFDM systems in MATLAB. It emphasizes the use of built-in functions like ofdmmod and ofdmdemod over manual FFT/IFFT implementations to avoid common subcarrier mapping errors. It covers critical aspects of OFDM design including subcarrier allocation, pilot insertion, channel estimation, synchronization, and LDPC coding, while highlighting version-specific API differences and proper SNR handling.
What it does
- Specifies correct calling conventions for ofdmmod, ofdmdemod, and related OFDM functions.
- Provides rules for subcarrier allocation, including null and pilot indexing.
- Defines the correct method for computing signal power and adding noise in OFDM simulations.
- Outlines workflows for pilot-based channel estimation and equalization.
- Details the integration of LDPC coding within an OFDM link.
- Provides guidance on configuring fading channels and synchronization pipelines.
When to use it
- When building custom, non-standard OFDM transmitters or receivers.
- When configuring subcarrier grids, guard bands, or pilot patterns.
- When implementing channel estimation, equalization, or synchronization for OFDM links.
- When adding LDPC forward error correction to an OFDM system.
- When simulating OFDM performance over AWGN or fading channels.
Advantages
- Prevents common silent errors caused by manual FFT/IFFT subcarrier mapping.
- Ensures physically accurate noise and SNR handling in OFDM simulations.
- Provides a structured approach to complex tasks like synchronization and channel estimation.
- Clarifies version-specific API usage for modern MATLAB releases.
- Reduces development time by providing clear, tested patterns for OFDM design.
Usage examples
- “How do I correctly modulate a signal for a 64-FFT OFDM system with 12 null subcarriers?”
- The agent will provide the code to define the nullIdx vector, calculate the active subcarrier count, and use ofdmmod with the correct parameters, ensuring proper subcarrier mapping.
- “I need to add AWGN to my OFDM signal. How do I calculate the correct power?”
- The agent will explain that signal power is not 1W and provide the formula 10*log10(nActiveSC / nFFT^2) to be used as the explicit power argument in the awgn function.
Install
Download the skill as a ZIP:
https://autogineer.com/agent-skills/matlab/matlab-design-ofdm-system/downloadUnzip it into the cross-client skills folder of your project:
mkdir -p .agents/skills && unzip matlab-design-ofdm-system.zip -d .agents/skills
Documentation by MathWorks
OFDM System Design
When To Use
Use this skill when the user wants to build a custom (non-standard) OFDM transmitter/receiver, configure subcarrier allocation, add noise to OFDM signals, equalize OFDM through fading channels, implement synchronization, or add LDPC coding.
When Not To Use
Do NOT use this skill for standards-specific OFDM (use 5G Toolbox for 5G NR, WLAN Toolbox for Wi-Fi, LTE Toolbox for 4G/LTE, Bluetooth Toolbox for Bluetooth, Satellite Communications Toolbox for satellite links).
GATE — Ask Before Coding
If the user's request does not specify or unambiguously imply ALL of the following, STOP and ask before generating any code. Present unclear items as a numbered list and ask whether the user wants to: (a) specify values, (b) have you derive them from other constraints (e.g., CP from delay spread, SCS from Doppler), or (c) use typical defaults. Do not assume defaults. Do not proceed until the user responds.
OFDM parameters — FFT size, CP length, subcarrier spacing, subcarrier allocation
Channel model — AWGN only, fading with perfect CSI, or fading with pilot-based estimation
Pilots — needed for channel estimation or phase tracking?
Coding — uncoded, or coded with a specific rate?
Synchronization — perfect sync, or include timing/CFO estimation?
Must-Follow Rules
ALWAYS use
ofdmmod/ofdmdemod— NEVER implement OFDM by directly callingifft/fft— The functions handle CP insertion/removal,ifftshift/fftshiftfor centered-frequency ordering, and pilot/null subcarrier management. Direct IFFT/FFT gets subcarrier mapping wrong (silent error). Input is[nDataSC × nSym]for SISO. Output is a time-domain column vector. Note: sync preambles (e.g., Schmidl-Cox) that require DFT-order subcarrier mapping may useifftdirectly, sinceofdmmodappliesifftshiftwhich changes the even/odd bin assignment. Windowing:ofdmmoddoes not support windowing. For raised cosine windowing, usecomm.OFDMModulatorfor the transmitter only (always useofdmdemodfunction for demodulation). Seereferences/ofdm-system-guide.mdfor capability comparison.Always use a
symOffsetvariable inofdmdemod— when passingnullidx(5th arg),symOffsetmust be explicitly provided as the 4th arg. The defaultsymOffsetvalue iscpLen(skip entire CP). Note:cpLen/2is more robust when timing synchronization is imperfect.Use explicit signal power in
awgn, NEVER'measured'or0—ofdmmodoutput power is NOT 1W. It equalsnActiveSC / nFFT^2due to MATLAB's 1/N IFFT normalization. Usingawgn(x, snr, 0)adds far too much noise. ComputesigPow = 10*log10(nActiveSC / nFFT^2)once before any loop — it is a constant determined by OFDM parameters.Use
ofdmChannelResponsefor frequency-domain channel response — do NOT computeH = fft(h, nFFT)directly.ofdmmodusesifftshiftinternally, so direct FFT-based channel responses have wrong subcarrier mapping. Pass the result toofdmEqualizefor equalization.When deriving OFDM parameters from physical specs, show the computation with comments — do not just state the values. Show how you calculate subcarrier spacing, FFT size, CP length, sample rate, guard subcarriers, etc. from bandwidth, delay spread, and Doppler spread. Add comments explaining each derivation step.
Check MATLAB version before using version-gated APIs — Functions like
ofdmChannelEstimate,ofdmPilotConfig(R2026a), andldpcPCM(R2025a) are not available on older releases. Unless the user specifically asks for code compatible with a previous version, callversion('-release')to get the current MATLAB release, then choose the appropriate API path.
Key Functions
| Function | Purpose | Since |
|---|---|---|
ofdmmod | OFDM modulation (IFFT + CP insertion) | R2018a |
ofdmdemod | OFDM demodulation (CP removal + FFT) | R2018a |
ofdmChannelResponse | Per-subcarrier channel response from path gains | R2023a |
ofdmEqualize | ZF/MMSE frequency-domain equalization | R2022b |
ofdmPilotConfig | Pilot location and symbol configuration | R2026a |
ofdmChannelEstimate | Pilot-based channel estimation (LS + denoising) | R2026a |
convertSNR | SNR conversion (snrsc, snr, ebno) | R2022a |
awgn | Add white Gaussian noise with explicit signal power | — |
Subcarrier Allocation
Subcarrier indices use centered-frequency ordering: index 1 = most negative frequency, index nFFT/2 + 1 = DC, index nFFT = most positive frequency.
Rules for subcarrier indices:
nullIdxandpilotIdxmust be vectors of 1-based integers in[1, nFFT]They must not overlap
DC subcarrier =
nFFT/2 + 1(always null it)ofdmmodinput X has size[nDataSC x nSym]— null and pilot subcarriers are excludedofdmdemodoutput has size[nDataSC x nSym]— nulls stripped, pilots returned separately
Example (WiFi-like 64-FFT):
nullIdx = [1:6, 33, 60:64].'; % 12 nulls (6 lower guard + DC + 5 upper guard)
pilotIdx = [12; 26; 40; 54]; % 4 pilots
nActiveSC = nFFT - length(nullIdx); % 52 (data + pilots)
nDataSC = nFFT - length(nullIdx) - length(pilotIdx); % 48Basic OFDM Tx/Rx (AWGN)
% Parameters
nFFT = 64; cpLen = 16;
nullIdx = [1:6, 33, 60:64].'; % 12 nulls
nActiveSC = nFFT - length(nullIdx); % 52
nDataSC = nActiveSC; % no pilots
M = 4; % QPSK
nSym = 100;
snr_sc = 10; % dB, per-subcarrier SNR
% Transmit
data = randi([0 M-1], nDataSC, nSym);
modData = pskmod(data, M, InputType="integer");
txSig = ofdmmod(modData, nFFT, cpLen, nullIdx);
% SNR conversion and noise
sigPow = 10*log10(nActiveSC / nFFT^2); % OFDM signal power (dBW)
snr_wb = convertSNR(snr_sc, "snrsc", "snr", ...
FFTLength=nFFT, NumActiveSubcarriers=nActiveSC);
rxSig = awgn(txSig, snr_wb, sigPow);
% Receive
symOffset = cpLen;
rxData = ofdmdemod(rxSig, nFFT, cpLen, symOffset, nullIdx);
demodData = pskdemod(rxData, M, OutputType="integer");
[numErr, ber] = biterr(data(:), demodData(:));SNR Handling for OFDM
SNR per subcarrier (SNR_sc) is the standard noise reference for OFDM simulations. If you need other noise metrics — Eb/No for theoretical BER comparison, or wideband SNR for awgn — use convertSNR to derive them from SNR_sc. See matlab-add-awgn for full convertSNR patterns and awgn usage.
For theoretical BER: convert SNR_sc to Eb/No via convertSNR(snr_sc, "snr", "ebno", BitsPerSymbol=log2(M)), then call berawgn(ebno, 'qam', M). Do NOT pass SNR_sc directly to berawgn or use it as Eb/No in erfc/qfunc closed-form expressions — SNR_sc ≠ Eb/No.
OFDM-specific points (beyond what the AWGN skill covers):
Signal power =
10*log10(nActiveSC / nFFT^2)dBW — due to MATLAB's 1/N IFFT normalizationnActiveSCincludes data AND pilot subcarriersAlways capture noise variance from
awgn's second output:[rxSig, nVar] = awgn(...). Do NOT compute noise variance manually from SNR formula — use the valueawgnreturns to stay in sync with its internal rounding.Noise variance after
ofdmdemodscales by nFFT:nVar_sc = nVar * nFFT(FFT sums N terms)convertSNR"snr" type = per-subcarrier SNR when converting from Eb/No or Es/No (each OFDM subcarrier carries one symbol). To convert per-subcarrier SNR to wideband SNR (forawgn), useconvertSNR(snr_sc, "snrsc", "snr", FFTLength=nFFT, NumActiveSubcarriers=nActiveSC).
Critical Gotchas
awgn(x, snr, 0) is WRONG for OFDM
OFDM signal power depends on nActiveSC and nFFT, not 1W.
% WRONG — assumes unit power (adds ~19 dB too much noise for 64-FFT)
rxSig = awgn(txSig, snr_wb, 0);
% CORRECT — explicit power, capture noise variance
sigPow = 10*log10(nActiveSC / nFFT^2);
[rxSig, nVar] = awgn(txSig, snr_wb, sigPow);symOffset is required in ofdmdemod
symOffset = cpLen; % skip entire CP (or cpLen/2 for imperfect timing)
rxData = ofdmdemod(rxSig, nFFT, cpLen, symOffset, nullIdx);Modulator/demodulator input must be a column vector for single-stream
All Communications Toolbox modulators (qammod, pskmod, etc.) process by columns — each column is an independent channel/stream. For single-stream OFDM, always pass bits or integers as a column vector:
% WRONG — [nSym x k] matrix: each column is treated as a separate stream
txData = reshape(txBits, nBitsPerSym, []).';
txSymbols = qammod(txData, M, InputType="bit", UnitAveragePower=true);
% CORRECT — column vector in, then reshape output to OFDM grid
txSymbols = qammod(txBits, M, InputType="bit", UnitAveragePower=true);
txSymbols = reshape(txSymbols, nActiveSC, nSym);Use multiple columns only when modulating independent MIMO streams or parallel codewords simultaneously.
DC subcarrier index
DC = nFFT/2 + 1. For nFFT=64, DC is index 33. Always include it in nullIdx.
ofdmEqualize hEst dimensions
With default DataFormat="3-D", hEst dimensions are:
[nSC × NS × NR]— static: same estimate applied to all OFDM symbols[(nSC*nSym) × NS × NR]— time-varying: per-symbol estimates collapsed into first dimension
Passing [nSC × nSym] directly is wrong — dim 2 is read as NS, not nSym:
% WRONG — hEst [nSC x nSym] misinterpreted as [nSC x NS=nSym]
eqData = ofdmEqualize(rxData, hEst_per_sym, nVar);
% CORRECT — collapse first dim to (nSC*nSym), keep stream/antenna dims
eqData = ofdmEqualize(rxData, reshape(hEst_per_sym, [], Ns, Nr), nVar);OFDM with Pilots
To insert pilots, pass pilotIdx and pilot symbols as additional arguments to ofdmmod/ofdmdemod. Signal power is based on nActiveSC (data + pilots), not nDataSC alone.
See references/ofdm-pilots-and-estimation.md for the full pilot insertion example.
Pilot-Based Channel Estimation (R2026a)
Use ofdmPilotConfig + ofdmChannelEstimate for pilot-based channel estimation without perfect CSI. If you have not already checked, get the current MATLAB version before deciding between the R2026a workflow and the pre-R2026a manual LS approach.
The ofdmChannelEstimate workflow differs from the legacy pilotIdx approach:
nullIdxcontains only guard bands (NOT DC) — DC becomes an active-grid position that you zero out manually.No
pilotIdxargument toofdmmod/ofdmdemod— build a full[nActiveSC x nSym]grid with data, pilots, and DC=0, then pass it directly.Pilot locations come from
ofdmPilotConfig, not from function arguments.rxSymis 3-D:[nActiveSC x nSym x nRx]— add the receive-antenna dimension even for SISO.
See references/ofdm-pilots-and-estimation.md for complete code examples.
OFDM over Fading Channels
Two approaches for channel equalization:
Perfect CSI (R2023a) — use
ofdmChannelResponsewith path gains fromcomm.RayleighChannel(requiresPathGainsOutputPort=true). GetpathFiltersfrominfo(channel).ChannelFilterCoefficients. PassH(:)toofdmEqualizefor time-varying SISO.Pilot-based estimation (R2026a) — use
ofdmPilotConfig+ofdmChannelEstimate.
Both approaches use ofdmEqualize with Algorithm="mmse" for final equalization. Always use explicit signal power in awgn (not 'measured') — fading changes the instantaneous power.
See references/ofdm-fading-channel.md for channel configuration (Rayleigh/Rician, Doppler, 3GPP profiles, ofdmEqualize dimensions).
Fading Channel Setup
Configure comm.RayleighChannel or comm.RicianChannel with PathGainsOutputPort=true. Key rules:
Always set
SampleRate(default is 1 Hz)Maximum path delay must be < CP duration:
max(PathDelays) < cpLen/SampleRateCompute Doppler from velocity:
fd = (velocity * carrierFreq) / physconst('LightSpeed')
See references/ofdm-fading-channel.md for full setup, 3GPP profiles, and quasi-static fading.
Synchronization
Pipeline: Coarse timing → CFO estimation → CFO correction → Fine timing → OFDM demod → Phase tracking
Key rules:
Use
frequencyOffsetfor CFO application/correction (not manualexp(-1j*2*pi*...))Use
timingEstimatefor cross-correlation timing detectionAlways
unwrappilot phase estimates before applying correction across symbols
See references/ofdm-synchronization.md for Schmidl-Cox, CP-based timing, Zadoff-Chu preambles, and complete Rx example.
LDPC Coding
Key rules:
Use
ldpcEncode/ldpcDecodewith config objects (NOT removedcomm.LDPCEncoder/comm.LDPCDecoder)Create config from parity check matrix only:
H = ldpcPCM(648, 324); encCfg = ldpcEncoderConfig(H); decCfg = ldpcDecoderConfig(H). Do NOT pass scalars or Name-Value pairs —ldpcEncoderConfig(648),ldpcEncoderConfig(648, 1/2), andldpcDecoderConfig(BlockLength=648)all error. If you have not already checked, get the current MATLAB version to decide betweenldpcPCM(R2025a+) andldpcQuasiCyclicMatrix(R2021b+).Include
CodingRateinconvertSNRwhen computing Eb/No for coded systemsPass
NoiseVarianceto demodulators, such asqamdemod, for proper LLR scaling; scale to frequency domain:nVar_sc = nVar * nFFTUse
OutputType="approxllr"for LLR computation
See references/ofdm-ldpc-coding.md for OFDM+LDPC workflow and multi-codeword framing.
Advanced Features
See references/ofdm-system-guide.md for:
Variable CP length — per-symbol CP via row vector
cpLensCommon OFDM configurations — WiFi-like, LTE-like, 5G-like parameter sets
SNR conversion — see
matlab-add-awgnskill for allconvertSNRpatternsNoise variance for soft demodulation — scaling after
ofdmdemod
Cross-References
matlab-add-awgn— when you need to add noise and calculate SNR conversions, use this skill. It covers allconvertSNRpatterns,awgnusage, and noise variance capture.
Reference Loading
Load references/ofdm-pilots-and-estimation.md when the user asks about pilot insertion, pilot-based channel estimation (R2026a ofdmChannelEstimate), or pre-R2026a LS estimation.
Load references/ofdm-fading-channel.md when the user asks about fading channel configuration, Rayleigh/Rician setup, Doppler calculation, 3GPP delay profiles, or ofdmEqualize dimension handling.
Load references/ofdm-synchronization.md when the user asks about timing synchronization, CFO estimation/correction, Schmidl-Cox, preamble design, or pilot-based phase tracking.
Load references/ofdm-ldpc-coding.md when the user asks about LDPC coding, forward error correction, ldpcEncode/ldpcDecode, NoiseVariance for soft decoding, or coded BER simulations.
Load references/ofdm-system-guide.md when the user asks about SNR conversion details, common OFDM configurations, noise variance for soft demodulation, or variable CP length.
Copyright 2026 The MathWorks, Inc.
Files
- ATTRIBUTION.mdAdded by AutoGineer1.0 KiB
- LICENSELicence file added by AutoGineer1.4 KiB
- SKILL.md15.6 KiB
- manifest.yaml606 B
- references/ofdm-fading-channel.md8.4 KiB
- references/ofdm-ldpc-coding.md7.9 KiB
- references/ofdm-pilots-and-estimation.md8.0 KiB
- references/ofdm-synchronization.md11.8 KiB
- references/ofdm-system-guide.md5.4 KiB
references/ofdm-fading-channel.md
Fading Channel for OFDM — Reference
Must-Follow Rules
Always set
SampleRate— default is 1 Hz. With realistic Doppler (e.g., 100 Hz), the constraintMaximumDopplerShift <= SampleRate/10will fail. SetSampleRate = nFFT * subcarrierSpacing.Enable
PathGainsOutputPort=true— required forofdmChannelResponse. Use this for perfect channel estimation and equalization as a simulation baseline.Use
ofdmChannelResponsefor per-subcarrier H — do NOT manually computeH = fft(h, nFFT).ofdmmodusesifftshiftinternally, so manual FFT gives wrong subcarrier mapping (silent error, degraded BER).Use explicit signal power in
awgnafter fading, NEVER'measured'— fading changes instantaneous power, but thermal noise floor is fixed.'measured'artificially adjusts noise to track fading — physically wrong.
Channel Object Configuration
comm.RayleighChannel (all NLOS paths)
channel = comm.RayleighChannel( ...
SampleRate=1e6, ...
PathDelays=[0 1e-6 2e-6], ... % seconds
AveragePathGains=[0 -3 -6], ... % dB
MaximumDopplerShift=50, ...
PathGainsOutputPort=true); % CRITICAL for equalization
[fadedSig, pathGains] = channel(txSig);
pathFilters = info(channel).ChannelFilterCoefficients;comm.RicianChannel (LOS + scattered)
channel = comm.RicianChannel( ...
SampleRate=1e6, ...
PathDelays=[0 1e-6], ...
AveragePathGains=[0 -5], ...
KFactor=10, ... % LOS/scattered ratio (linear, NOT dB)
DirectPathDopplerShift=0, ...
DirectPathInitialPhase=0, ...
MaximumDopplerShift=50, ...
PathGainsOutputPort=true);KFactor gotchas:
Applies to first path only (scalar) or per-path (vector matching PathDelays)
KFactor=0is NOT allowed — usecomm.RayleighChannelinsteadWhen vector,
DirectPathDopplerShiftandDirectPathInitialPhasemust also be vectors
When to use Rician vs Rayleigh
Rayleigh — no line-of-sight: urban NLOS, indoor obstructed, rich scattering
Rician — line-of-sight exists: rural, rooftop-to-rooftop, satellite, short-range LOS
Key Properties
| Property | Default | Description |
|---|---|---|
SampleRate | 1 | Input signal sample rate (Hz). Always set. |
PathDelays | 0 | Row vector of path delays in seconds |
AveragePathGains | 0 | Path gains in dB (scalar when single path, vector matching length of PathDelays) |
MaximumDopplerShift | 0.001 | Max Doppler (Hz). Must be <= SampleRate/10 |
PathGainsOutputPort | false | Set true for equalization |
NormalizePathGains | true | Normalize so linear sum = 1 (preserves power) |
DopplerSpectrum | doppler('Jakes') | Jakes, Flat, Bell, Gaussian, etc. |
RandomStream | 'Global stream' | 'mt19937ar with seed' for reproducibility |
Seed | 73 | Seed when using mt19937ar |
Key methods
| Method | Description |
|---|---|
[y, pg] = ch(x) | Filter signal, get path gains |
info(ch) | Returns ChannelFilterCoefficients, ChannelFilterDelay |
reset(ch) | New realization (global stream) or restore initial state (seeded stream) |
Computing Doppler from Velocity
c = physconst("LightSpeed"); % 299792458 m/s
fc = 2.4e9; % carrier frequency (Hz)
v_kmh = 120; % velocity (km/h)
fd = (v_kmh / 3.6) * fc / c; % max Doppler shift (Hz)
% 120 km/h at 2.4 GHz → fd ≈ 267 Hz| Carrier | 30 km/h | 60 km/h | 120 km/h |
|---|---|---|---|
| 900 MHz | 25 Hz | 50 Hz | 100 Hz |
| 2.4 GHz | 67 Hz | 133 Hz | 267 Hz |
| 3.5 GHz | 97 Hz | 195 Hz | 389 Hz |
| 28 GHz | 778 Hz | 1557 Hz | 3113 Hz |
Path Delay Constraint for OFDM
Maximum path delay must be less than CP duration, otherwise ISI corrupts the signal:
maxDelay = max(pathDelays); % seconds
cpDuration = cpLen / sampleRate; % seconds
assert(maxDelay < cpDuration, 'Max path delay exceeds CP — ISI will occur')ofdmChannelResponse
H = ofdmChannelResponse(pathGains, pathFilters, nFFT, cpLen, activeIdx)
H = ofdmChannelResponse(pathGains, pathFilters, nFFT, cpLen, activeIdx, timingOffset)pathGains— from channel second output[Nsamp x Npaths](SISO)pathFilters— frominfo(channel).ChannelFilterCoefficients[Npaths x Ncoeff]activeIdx—setdiff((1:nFFT).', nullIdx)— column vector of active subcarrier indicestimingOffset— fromchannelDelay(pathGains, pathFilters)(default 0)Returns —
[nActiveSC x nOFDMSym](SISO)
Introduced R2023a.
ofdmEqualize
[eqSym, csi] = ofdmEqualize(rxSym, H, nVar)
[eqSym, csi] = ofdmEqualize(rxSym, H, nVar, Algorithm="mmse")Hdimension rules (DataFormat="3-D", default):[nSC x Ns x Nr]— static (same H for all symbols)[(nSC*nSym) x Ns x Nr]— time-varying (usereshape(H, [], Ns, Nr))NEVER pass
[nSC x nSym]— dim 2 is interpreted as Tx streams, giving[nSC x nSym x nSym]output (silent wrong result)
nVar— noise variance per subcarrier (linear)csi— channel state information (reliability weights for soft decoding)
Introduced R2022b.
3GPP Delay Profiles
| Profile | Paths | Max Delay | Use Case |
|---|---|---|---|
| EPA | 7 | 410 ns | Low delay spread (indoor, small cell) |
| EVA | 9 | 2.51 μs | Medium delay spread (urban) |
| ETU | 9 | 5.0 μs | High delay spread (large cell) |
% EPA (Extended Pedestrian A)
epa.delays = [0 30 70 90 110 190 410] * 1e-9;
epa.gains = [0 -1 -2 -3 -8 -17.2 -20.8];
% EVA (Extended Vehicular A)
eva.delays = [0 30 150 310 370 710 1090 1730 2510] * 1e-9;
eva.gains = [0 -1.5 -1.4 -3.6 -0.6 -9.1 -7.0 -12.0 -16.9];
% ETU (Extended Typical Urban)
etu.delays = [0 50 120 200 230 500 1600 2300 5000] * 1e-9;
etu.gains = [-1 -1 -1 0 0 0 -3 -5 -7];For 5G NR channel models (TDL, CDL), use nrTDLChannel/nrCDLChannel from 5G Toolbox.
Quasi-Static Fading (Block Fading)
Set MaximumDopplerShift=0 for a channel that stays constant within one call (one frame):
channel = comm.RayleighChannel(SampleRate=1e6, ...
PathDelays=[0 1e-6], AveragePathGains=[0 -3], ...
MaximumDopplerShift=0, PathGainsOutputPort=true, ...
RandomStream="mt19937ar with seed", Seed=42);With MaximumDopplerShift=0, the channel is constant (quasi-static) — repeated calls to channel(x) return the same fading realization. Calling reset(channel) draws a new random realization (with the global stream) or restores the original realization (with a seeded stream).
To simulate multiple independent frames with quasi-static fading (fastest approach):
% Use global stream (NOT seeded) so reset() gives a new realization each time
channel = comm.RayleighChannel(SampleRate=1e6, ...
PathDelays=[0 1e-6], AveragePathGains=[0 -3], ...
MaximumDopplerShift=0, PathGainsOutputPort=true);
for frame = 1:numFrames
reset(channel); % New independent realization (fast)
[fadedSig, pathGains] = channel(txSig);
% ... process frame ...
endDo NOT use release(channel) + seed change inside the loop — release rebuilds internal state and is significantly slower. Use seeded streams only if the user specifically asks for reproducibility. Even then, warn the user that release/set-seed inside the loop is slow. Default to the global stream for maximum run speed.
Reproducibility
channel = comm.RayleighChannel(SampleRate=1e6, ...
PathDelays=[0 1e-6], AveragePathGains=[0 -3], ...
MaximumDopplerShift=50, PathGainsOutputPort=true, ...
RandomStream="mt19937ar with seed", Seed=42);
[y1, ~] = channel(txSig);
reset(channel);
[y2, ~] = channel(txSig);
% y1 and y2 are identicalTheoretical BER over Fading (Per Subcarrier)
EbNo = 0:2:30;
berRay = berfading(EbNo, "psk", 4, 1); % Rayleigh, no diversity
berRic = berfading(EbNo, "psk", 4, 1, 5); % Rician K=5
berAWGN = berawgn(EbNo, "psk", 4, "nondiff"); % AWGN reference
semilogy(EbNo, berAWGN, EbNo, berRic, EbNo, berRay);
legend("AWGN", "Rician K=5", "Rayleigh");
xlabel("Eb/No (dB)"); ylabel("BER"); grid on;berfading takes Eb/No (not SNR), modulation type, modulation order, diversity order, and optionally K-factor (linear). In OFDM, each subcarrier experiences flat fading — these curves give the per-subcarrier BER. Convert SNR_sc to Eb/No via convertSNR before comparing.
Copyright 2026 The MathWorks, Inc.
Requirements and compatibility
Works with: Claude Code, Claude apps, OpenAI Codex, GitHub Copilot, Cursor, Gemini CLI, Kiro, OpenCode, Goose, Amp, Roo Code, JetBrains Junie, Factory Droid, Devin (ex-Windsurf), Mistral Vibe, OpenHands, Letta
“Works with” means the tool reads the open Agent Skills format; a skill written for one tool may use features others lack.
Security
No issues found by our static scan· No issues found
A static scan is not a guarantee. Skills are third-party content: review a skill before you let an agent use it.
Attribution and licence
- Created by
- MathWorks
- Publisher
- MathWorks (Official)
- Source
- matlab/matlab-agentic-toolkit · skills-catalog/wireless-communications/matlab-design-ofdm-system · commit 2a7f215
- Licence
- BSD 2-Clause License (redistribution allowed)
- LICENSE (added by AutoGineer from LICENSE.md)
- ATTRIBUTION.md (written by AutoGineer)
- Synced
AutoGineer is not affiliated with or endorsed by MathWorks or MathWorks.
Download ZIP
The ZIP holds the skill’s files, its licence files and an ATTRIBUTION.md. Download matlab-design-ofdm-system.zip