Install any skill in seconds. Free to start, no credit card required.
Get Started Free →Designs, simulates, and equalizes custom OFDM transmitters and receivers in MATLAB using ofdmmod, ofdmdemod, and related functions.
43% 96%+52 ptsof test cases passed
Passed 22 of 23 test cases with the skill, and 10 of 23 without it.
I need a MATLAB script for an OFDM link with 128-point FFT, 32 CP length, 15 kHz SCS, guard subcarriers [1:8, 65, 121:128]', uncoded 16-QAM, and no pilots. Generate the code.
Stops to ask clarification questions regarding missing parameters before generating code.
This test ran on v1. v2 is the current version and hasn’t been tested on gemini-3.6-flash yet.
3 of 3 safety checks passed
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.
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), or for 6G, pre-6G or OFDM-based ISAC work (use matlab-simulate-6g-system).
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.
ALWAYS use ofdmmod/ofdmdemod — NEVER implement OFDM by directly calling ifft/fft — The functions handle CP insertion/removal, ifftshift/fftshift for 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 use ifft directly, since ofdmmod applies ifftshift which changes the even/odd bin assignment. Windowing: ofdmmod does not support windowing. For raised cosine windowing, use comm.OFDMModulator for the transmitter only (always use ofdmdemod function for demodulation). See references/ofdm-system-guide.md for capability comparison.
Always use a symOffset variable in ofdmdemod — when passing nullidx (5th arg), symOffset must be explicitly provided as the 4th arg. The default symOffset value is cpLen (skip entire CP). Note: cpLen/2 is more robust when timing synchronization is imperfect.
Use explicit signal power in awgn, NEVER 'measured' or 0 — ofdmmod output power is NOT 1W. It equals nActiveSC / nFFT^2 due to MATLAB's 1/N IFFT normalization. Using awgn(x, snr, 0) adds far too much noise. Compute sigPow = 10*log10(nActiveSC / nFFT^2) once before any loop — it is a constant determined by OFDM parameters.
Use ofdmChannelResponse for frequency-domain channel response — do NOT compute H = fft(h, nFFT) directly. ofdmmod uses ifftshift internally, so direct FFT-based channel responses have wrong subcarrier mapping. Pass the result to ofdmEqualize for 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), and ldpcPCM (R2025a) are not available on older releases. Unless the user specifically asks for code compatible with a previous version, call version('-release') to get the current MATLAB release, then choose the appropriate API path.
| Function | Purpose | Since |
|---|---|---|
ofdmmod | OFDM modulation (IFFT + CP insertion) | R2018a |
ofdmdemod | OFDM demodulation (CP removal + FFT) | R2018a |
Next to this one in the catalogue, plus more from the same author.