Agent Skillsmatlab/matlab-agentic-toolkit › matlab-generate-5g-waveform

matlab-generate-5g-waveform

GitHub

生成符合3GPP标准的5G NR上下行基带波形,支持TM/FRC及自定义信道配置,用于信号生成、RF仪器回放和IQ合成。

skills-catalog/wireless-communications/matlab-generate-5g-waveform/SKILL.md matlab/matlab-agentic-toolkit

Trigger Scenarios

生成5G NR下行或上行波形 创建测试模型(TM)或固定参考信道(FRC) 配置PDSCH/PUSCH等信道参数

Install

npx skills add matlab/matlab-agentic-toolkit --skill matlab-generate-5g-waveform -g -y
More Options

Non-standard path

npx skills add https://github.com/matlab/matlab-agentic-toolkit/tree/main/skills-catalog/wireless-communications/matlab-generate-5g-waveform -g -y

Use without installing

npx skills use matlab/matlab-agentic-toolkit@matlab-generate-5g-waveform

指定 Agent (Claude Code)

npx skills add matlab/matlab-agentic-toolkit --skill matlab-generate-5g-waveform -a claude-code -g -y

安装 repo 全部 skill

npx skills add matlab/matlab-agentic-toolkit --all -g -y

预览 repo 内 skill

npx skills add matlab/matlab-agentic-toolkit --list

SKILL.md

Frontmatter
{
    "name": "matlab-generate-5g-waveform",
    "license": "https:\/\/www.mathworks.com\/content\/dam\/mathworks\/license\/pmrl\/license.md",
    "metadata": {
        "author": "MathWorks",
        "version": "1.0"
    },
    "description": "Generate 3GPP-compliant 5G NR downlink and uplink baseband waveforms. Use to create NR signals, test model (TM) waveforms, fixed reference channels (FRC), test and measurement (T&M) signals, or test vectors for conformance testing. Covers configuring data, control, and broadcast channels and signals: PDSCH, PUSCH, PDCCH, PUCCH, SRS, SSBurst, CSI-RS, DM-RS, PT-RS, CORESET, and BWP parameters including bandwidth, subcarrier spacing (SCS), modulation (QPSK, QAM), numerology, FR1, FR2, TDD, FDD, and multi-bandwidth-part setups. Use for signal generation, RF instrument playback, or IQ baseband synthesis. Requires 5G Toolbox.\n",
    "compatibility": ">=R2024b"
}

Generate 5G NR Waveforms

Generate standard-compliant 5G NR downlink and uplink waveforms for test and measurement, simulation, and verification using nrWaveformGenerator.

When to Use

  • Generate a 5G, NR, or New Radio waveform
  • Create DL waveforms with PDSCH, PDCCH, SSBurst, CSI-RS
  • Create UL waveforms with PUSCH, PUCCH, SRS
  • Generate NR test model (TM) or fixed reference channel (FRC) waveforms
  • Configure waveform parameters: bandwidth, SCS, modulation, power levels
  • Create multi-bandwidth-part waveforms

When NOT to Use

  • Channel modeling or propagation — use nrCDLChannel, nrTDLChannel
  • Receiver processing or decoding — use nrPDSCHDecode, nrDLSCHDecoder
  • Link-level simulation end-to-end

API Choice

Need API Notes
Standard test model (TM) hNRReferenceWaveformGenerator Predefined 3GPP configs. See test-models-and-frc.md
Fixed reference channel (FRC) hNRReferenceWaveformGenerator DL and UL FRCs
Custom DL waveform nrDLCarrierConfig + nrWaveformGenerator Full control over all DL channels
Custom UL waveform nrULCarrierConfig + nrWaveformGenerator Full control over all UL channels

Do NOT use primitive-level functions (nrCarrierConfig + nrPDSCH + nrOFDMModulate) for waveform generation. These are for individual channel signal processing, not waveform construction. nrWaveformGenerator handles channel multiplexing, power scaling, and OFDM modulation correctly.

Workflow

Custom DL or UL Waveform

  1. Create carrier config using the simplified constructor (R2026a+):
cfg = nrDLCarrierConfig('FR1', 20, 30);  % DL: FR1, 20 MHz, 30 kHz SCS
cfg = nrULCarrierConfig('FR1', 20, 15);  % UL: FR1, 20 MHz, 15 kHz SCS

This auto-populates SCSCarriers, BandwidthParts, SSBurst/CORESET (DL only), and a default PDSCH or PUSCH with valid parameters sized to the bandwidth.

Requires R2026a or later. On earlier releases, use the manual approach shown in the Narrow Bandwidth DL pattern — create nrDLCarrierConfig with no arguments and set SCSCarriers, BandwidthParts, and channels explicitly.

Constructor side effect: For DL, the constructor adds a dedicated SCS carrier for SSBurst if the requested SCS doesn't match the default SSB numerology. For example, nrDLCarrierConfig('FR1', 5, 30) creates a hidden 15 kHz carrier (20 RBs) for SSBurst Case A. Use manual config instead when you need exact control over the number of SCS carriers.

  1. Customize channels — modify defaults or add channels:
cfg.PDSCH{1}.Modulation = '64QAM';
cfg.PDSCH{1}.Power = -3;
cfg.PDSCH{1}.DMRSPower = -6;
cfg.NumSubframes = 10;
  1. Oversample (optional) — set sample rate before generation for DAC playback:
cfg.SampleRate = 245.76e6;  % Oversampled rate (default: minimum for the BW)
  1. Validate — check the critical rules in the next section before generating.

  2. Generate and verifyvalidateConfig checks structural rules but does not detect channel conflicts (e.g., overlapping PDSCH/CSI-RS, CSI-RS/SSBurst). Always call nrWaveformGenerator to catch these:

[waveform, info] = nrWaveformGenerator(cfg);
  1. Visualize — open the config in the 5G Waveform Generator app:
openInGenerator(cfg);
  1. Inspect output:
sr = info.ResourceGrids(1).Info.SampleRate;
grid = info.ResourceGrids(1).ResourceGridBWP;

Test Model or FRC

hNRReferenceWaveformGenerator is an example helper — set up a working directory with setupExample before use (no path modification needed):

[exDir, ~] = setupExample('5g/NRTestModelWaveformGenerationExample', fullfile(tempdir, 'tmfrc'));
workDir = fullfile(tempdir, 'myTMWaveform');
mkdir(workDir);
copyfile(fullfile(exDir, '*'), workDir);
cd(workDir);

Then generate:

wavegen = hNRReferenceWaveformGenerator('NR-FR1-TM1.1', '10MHz', '15kHz', 'FDD');
[waveform, waveinfo] = generateWaveform(wavegen);
displayResourceGrid(wavegen);

See references/test-models-and-frc.md for all valid model names and options.

Key Functions

Function / Class Purpose
nrWaveformGenerator Generate time-domain waveform from carrier config
nrDLCarrierConfig DL carrier config (wraps all DL channels)
nrULCarrierConfig UL carrier config (wraps all UL channels)
nrSCSCarrierConfig SCS carrier: SubcarrierSpacing, NSizeGrid, NStartGrid
nrWavegenBWPConfig BWP: SubcarrierSpacing, NSizeBWP, NStartBWP
nrWavegenPDSCHConfig PDSCH: Modulation, Power, DMRSPower, PRBSet
nrWavegenPUSCHConfig PUSCH: Modulation, Power, DMRSPower
nrWavegenPUCCH0Config .. nrWavegenPUCCH4Config PUCCH formats 0–4
nrWavegenSRSConfig SRS config
nrWavegenPDCCHConfig PDCCH config (links via SearchSpaceID)
nrCORESETConfig CORESET: FrequencyResources, Duration
nrSearchSpaceConfig Links PDCCH to CORESET via IDs
nrWavegenSSBurstConfig SS burst: BlockPattern, TransmittedBlocks
nrWavegenCSIRSConfig CSI-RS config
hNRReferenceWaveformGenerator Standard TMs and FRCs (example helper)
validateConfig Check structural rules (method on carrier config)
openInGenerator Open config in 5G Waveform Generator app

If you need to verify property names, check valid values for a config object, or look up parameters not covered in this skill, consult the online documentation links in references/documentation-links.md.

Do not mix API levels. These primitive objects are incompatible with nrWaveformGenerator:

Use with nrWaveformGenerator Do NOT use with nrWaveformGenerator
nrDLCarrierConfig / nrULCarrierConfig nrCarrierConfig
nrWavegenPDSCHConfig nrPDSCHConfig
nrWavegenPUSCHConfig nrPUSCHConfig

Critical Rules

These parameter constraints cause the most errors. Check all of them before calling nrWaveformGenerator.

NSizeGrid Must Match Channel Bandwidth

Look up NSizeGrid from the bandwidth tables. The simplified constructor (R2026a+) handles this automatically. To look up values programmatically:

nrDLCarrierConfig.FR1BandwidthTable
nrDLCarrierConfig.FR2BandwidthTable

BWP Must Fit Within SCS Carrier

NStartBWP >= NStartGrid
NStartBWP + NSizeBWP <= NStartGrid + NSizeGrid

The BWP SubcarrierSpacing must exactly match one SCS carrier's SubcarrierSpacing.

CORESET Must Fit Within BWP

Each bit set to 1 in FrequencyResources allocates 6 RBs. Total must not exceed NSizeBWP:

6 * sum(FrequencyResources) <= NSizeBWP

Max bits to set: floor(NSizeBWP / 6). For narrow bandwidths:

NSizeBWP Max bits Example FrequencyResources
11 1 [1 zeros(1,44)]
24 4 [1 1 1 1 zeros(1,41)]
51 8 [ones(1,8) zeros(1,37)]

SSB Carrier Must Be at Least 20 RBs

The SCS carrier at the SSB numerology must have NSizeGrid >= 20.

BlockPattern SSB SCS
Case A 15 kHz
Case B 30 kHz
Case C 30 kHz
Case D 120 kHz
Case E 240 kHz

When the user does not specify SSB parameters, choose a BlockPattern that matches the user's SCS carrier so no extra carrier is needed:

User's SCS Use BlockPattern SSB SCS
15 kHz Case A 15 kHz
30 kHz Case B 30 kHz
60 kHz Case B (FR1) 30 kHz — add a 30 kHz carrier if none exists
120 kHz Case D 120 kHz

When the user explicitly requests SSB parameters that require a different SCS than the main carrier, add a dedicated SCS carrier for the SSB:

% Example: user wants Case A (15 kHz SSB) on a 30 kHz carrier
scsSSB = nrSCSCarrierConfig;
scsSSB.SubcarrierSpacing = 15;
scsSSB.NSizeGrid = 20;        % Minimum for SSB
scsSSB.NStartGrid = 0;
cfg.SCSCarriers{end+1} = scsSSB;
cfg.SSBurst.BlockPattern = 'Case A';

Disable SSBurst only when the carrier is too narrow to support any SSB (e.g., 5 MHz / 30 kHz → 11 RBs at 30 kHz, and no room for a 20-RB carrier at any SSB numerology):

cfg.SSBurst.Enable = false;

Point A Centering Constrains Multi-Carrier Layouts

When multiple SCS carriers coexist, Point A is positioned so the highest-SCS carrier is centered within the channel bandwidth. This means the lower-SCS carrier may need fewer RBs than the bandwidth table maximum. For example, 40 MHz with a full 30 kHz carrier (106 RBs) only fits 214 RBs at 15 kHz, not the table value of 216. Always call validateConfig(cfg) to check, and reduce NSizeGrid if needed.

CSI-RS Must Not Conflict With Other Channels

Within the same BWP, nrWaveformGenerator automatically reserves REs for CSI-RS — conflicts only arise between DM-RS and CSI-RS. Across different BWPs that overlap in frequency, CSI-RS defaults span the full BWP and can collide with PDSCH, PDCCH, or SSBurst. Fix with NumRB and RBOffset:

csirs1 = nrWavegenCSIRSConfig;
csirs1.BandwidthPartID = 1;
csirs1.NumRB = 106;       % Match PDSCH1 frequency region
csirs1.RBOffset = 0;
csirs1.SymbolLocations = 6;  % Avoid PDCCH symbols 0-2

CSI-RS can also conflict with SSBurst when their frequency regions overlap. This applies to any CSI-RS on any BWP — check each one. To resolve, try these approaches in order:

  1. NumRB/RBOffset — narrow the CSI-RS to a frequency region that does not overlap the SSBurst carrier (works when SSBurst does not span the full bandwidth)
  2. SymbolLocations — move CSI-RS to symbols not used by SSBurst
  3. CSIRSPeriod — adjust periodicity and slot offset so CSI-RS avoids slots containing SSBurst

The right fix depends on the overall parameter set. Always call nrWaveformGenerator to verify no conflicts remain.

PDCCH Conflicts With PDSCH Across BWPs or RNTIs

Within the same BWP and RNTI, nrWaveformGenerator automatically reserves REs for PDCCH (via the CORESET region). PDCCH conflicts with PDSCH when:

  • They are on different overlapping BWPs
  • They have different RNTIs on the same BWP

To resolve, separate them in time (SymbolAllocation, SlotAllocation) or frequency (PRBSet).

PDSCH/PUSCH PRBSet Must Fit Within BWP

max(PRBSet) < NSizeBWP

For full-band allocation: PRBSet = 0:NSizeBWP-1.

PDCCH Links Through SearchSpace to CORESET

PDCCH.SearchSpaceID must reference a valid SearchSpace, which must reference a valid CORESET via CORESETID. All IDs must exist.

Patterns

Basic DL Waveform

% 20 MHz, 30 kHz SCS downlink waveform with 64QAM PDSCH
cfg = nrDLCarrierConfig('FR1', 20, 30);
cfg.PDSCH{1}.Modulation = '64QAM';
cfg.NumSubframes = 10;

[waveform, info] = nrWaveformGenerator(cfg);

% Plot resource grid
figure;
imagesc(abs(info.ResourceGrids(1).ResourceGridBWP(:,:,1)));
axis xy;
xlabel('OFDM Symbols');
ylabel('Subcarriers');
title('5G NR DL Resource Grid');
colorbar;

Basic UL Waveform

% 20 MHz, 15 kHz SCS uplink waveform with QPSK PUSCH
cfg = nrULCarrierConfig('FR1', 20, 15);
cfg.PUSCH{1}.Modulation = 'QPSK';
cfg.NumSubframes = 10;

[waveform, info] = nrWaveformGenerator(cfg);

Narrow Bandwidth DL (5 MHz, 30 kHz SCS)

Narrow bandwidths need manual config because CORESET defaults are too wide. SSBurst must be disabled here because there is no SCS carrier at the SSB numerology. (The simplified constructor avoids this by adding one automatically.)

cfg = nrDLCarrierConfig;
cfg.ChannelBandwidth = 5;

cfg.SCSCarriers = {nrSCSCarrierConfig};
cfg.SCSCarriers{1}.SubcarrierSpacing = 30;
cfg.SCSCarriers{1}.NSizeGrid = 11;   % 5 MHz at 30 kHz

cfg.BandwidthParts = {nrWavegenBWPConfig};
cfg.BandwidthParts{1}.SubcarrierSpacing = 30;
cfg.BandwidthParts{1}.NSizeBWP = 11;

% SSB needs 20 RBs — disable for 11-RB carrier
cfg.SSBurst.Enable = false;

% CORESET: max 1 group (6 RBs) for 11-RB BWP
cfg.CORESET{1}.FrequencyResources = [1 zeros(1,44)];
cfg.CORESET{1}.Duration = 2;  % Must be 2 for interleaved mapping with 1 group
cfg.PDCCH{1}.Enable = false;  % Only 2 CCEs — too few for default AggregationLevel

% PDSCH: fit within BWP
cfg.PDSCH{1}.PRBSet = 0:10;
cfg.PDSCH{1}.Power = -3;
cfg.PDSCH{1}.DMRSPower = -6;

[waveform, info] = nrWaveformGenerator(cfg);

Test Model Waveform

% NR-FR1-TM1.1 at 10 MHz, 15 kHz SCS
wavegen = hNRReferenceWaveformGenerator('NR-FR1-TM1.1', '10MHz', '15kHz', 'FDD');
[waveform, waveinfo] = generateWaveform(wavegen);
displayResourceGrid(wavegen);

To modify test model parameters (e.g., enable transport coding):

wavegen = makeConfigWritable(wavegen);
pdschArray = [wavegen.Config.PDSCH{:}];
[pdschArray.Coding] = deal(true);
wavegen.Config.PDSCH = num2cell(pdschArray);
[waveform, waveinfo] = generateWaveform(wavegen);

Multi-BWP Waveform

For waveforms with multiple bandwidth parts and numerologies, see references/multi-bwp-guidance.md.

Output Structure

[waveform, info] = nrWaveformGenerator(cfg) returns:

Field Contents
waveform Complex time-domain samples (N x P, P = antennas)
info.ResourceGrids(k).ResourceGridBWP Grid sized to BWP (NSizeBWP*12 subcarriers)
info.ResourceGrids(k).ResourceGridInCarrier Grid sized to full carrier
info.ResourceGrids(k).Info.SampleRate Waveform sample rate
info.ResourceGridSSBurst.ResourceGrid SSB grid (DL only)
info.WaveformResources.PDSCH Per-slot PDSCH resources (indices, symbols)

There is no field called ResourceGrid in info.ResourceGrids. Use ResourceGridBWP or ResourceGridInCarrier.

[waveform, waveinfo] = generateWaveform(wavegen) for hNRReferenceWaveformGenerator returns:

Field Contents
waveinfo.ResourceGridBWP Resource grid
waveinfo.Info.SampleRate Sample rate

Conventions

  • After generating a waveform, unless the user asks for something specific:
    1. Tell the user the waveform variable name and that it is in the workspace
    2. Plot the resource grid
    3. Save the generation code as a .m script and open it in the MATLAB editor with edit('scriptName.m')
  • Use nrWaveformGenerator, not primitive functions (nrPDSCH + nrOFDMModulate)
  • Start with the simplified constructor nrDLCarrierConfig('FR1', bw, scs) when possible
  • Use nrWavegenPDSCHConfig (not nrPDSCHConfig) with nrWaveformGenerator
  • Correct property names: DMRSPower (not PowerDMRS), PTRSPower (not PowerPTRS), NSizeGrid (not NRB), ChannelBandwidth (not Bandwidth)
  • SCSCarriers, BandwidthParts, CORESET, PDSCH, PUSCH are cell arrays — use {}
  • SSBurst is a direct object — use . not {}
  • Use tiledlayout/nexttile for multi-panel figures
  • Always label axes with units and include figure titles

Copyright 2026 The MathWorks, Inc.

Version History

  • 2026.08.13 Current 2026-08-16 07:23
  • 2026.07.16 2026-07-24 16:24

Same Skill Collection

skills-catalog/ai-and-statistics/matlab-create-experiment/SKILL.md
skills-catalog/ai-and-statistics/matlab-use-machine-learning-apps/SKILL.md
skills-catalog/automotive/roadrunner-asset-mapping/SKILL.md
skills-catalog/automotive/roadrunner-convert-lanelet2-to-rrhd/SKILL.md
skills-catalog/automotive/roadrunner-core/SKILL.md
skills-catalog/automotive/roadrunner-import-scene/SKILL.md
skills-catalog/automotive/roadrunner-rrhd-authoring/SKILL.md
skills-catalog/automotive/roadrunner-scenario-authoring/SKILL.md
skills-catalog/code-generation/matlab-deploy-embedded-code/SKILL.md
skills-catalog/code-generation/matlab-optimize-gpu-codegen/SKILL.md
skills-catalog/code-generation/matlab-review-fi-code/SKILL.md
skills-catalog/code-generation/matlab-review-fi-object-code/SKILL.md
skills-catalog/computational-biology/matlab-build-simbiology-model/SKILL.md
skills-catalog/computational-biology/matlab-fit-simbiology-model/SKILL.md
skills-catalog/computational-biology/matlab-simulate-simbiology-model/SKILL.md
skills-catalog/computational-finance/matlab-access-datafeed/SKILL.md
skills-catalog/computational-finance/matlab-use-spreadsheet-link/SKILL.md
skills-catalog/control-systems/matlab-extract-battery-features/SKILL.md
skills-catalog/control-systems/matlab-extract-rotating-machinery-features/SKILL.md
skills-catalog/control-systems/matlab-identify-linear-system/SKILL.md
skills-catalog/image-processing-and-computer-vision/matlab-display-image/SKILL.md
skills-catalog/image-processing-and-computer-vision/matlab-display-volume/SKILL.md
skills-catalog/image-processing-and-computer-vision/matlab-model-optics/SKILL.md
skills-catalog/image-processing-and-computer-vision/matlab-point-cloud-file-io/SKILL.md
skills-catalog/image-processing-and-computer-vision/matlab-point-cloud-registration/SKILL.md
skills-catalog/image-processing-and-computer-vision/matlab-process-large-images/SKILL.md
skills-catalog/image-processing-and-computer-vision/matlab-read-write-point-cloud-file/SKILL.md
skills-catalog/image-processing-and-computer-vision/matlab-register-point-clouds/SKILL.md
skills-catalog/math-and-optimization/matlab-solve-optimization/SKILL.md
skills-catalog/matlab-core/matlab-create-live-script/SKILL.md
skills-catalog/matlab-core/matlab-debug-code/SKILL.md
skills-catalog/matlab-core/matlab-debugging/SKILL.md
skills-catalog/matlab-core/matlab-install-products/SKILL.md
skills-catalog/matlab-core/matlab-list-products/SKILL.md
skills-catalog/matlab-core/matlab-read-doc/SKILL.md
skills-catalog/matlab-core/matlab-read-documentation/SKILL.md
skills-catalog/matlab-core/matlab-review-code/SKILL.md
skills-catalog/matlab-core/matlab-testing/SKILL.md
skills-catalog/matlab-core/matlab-write-test/SKILL.md
skills-catalog/matlab-data-import-and-analysis/matlab-analyze-data/SKILL.md
skills-catalog/matlab-data-import-and-analysis/matlab-import-export-data/SKILL.md
skills-catalog/matlab-environment-and-settings/matlab-migrate-settings/SKILL.md
skills-catalog/matlab-external-language-interfaces/matlab-call-python/SKILL.md
skills-catalog/matlab-software-development/matlab-analyze-dependencies/SKILL.md
skills-catalog/matlab-software-development/matlab-assess-toolbox/SKILL.md
skills-catalog/matlab-software-development/matlab-build-toolbox/SKILL.md
skills-catalog/matlab-software-development/matlab-create-buildfile/SKILL.md
skills-catalog/matlab-software-development/matlab-create-project/SKILL.md
skills-catalog/matlab-software-development/matlab-define-toolbox-api/SKILL.md
skills-catalog/matlab-software-development/matlab-document-toolbox/SKILL.md

Metadata

Files
0
Version
2026.08.13
Hash
32a59f66
Indexed
2026-07-24 16:24

Accueil - Wiki
Copyright © 2011-2026 iteam. Current version is 2.155.2. UTC+08:00, 2026-08-26 22:28
浙ICP备14020137号-1 $Carte des visiteurs$