pskmod — Map integers or bit groups to PSK constellation points in MATLAB and RunMat.
pskmod(X, M) maps integer symbols or bit groups to unit-magnitude M-PSK complex-baseband samples. Phase offset, Gray ordering, binary ordering, custom symbol ordering, bit input, and output precision follow the MATLAB Communications Toolbox surface.
Syntax
Y = pskmod(X, M)
Y = pskmod(X, M, phaseoffset, symorder, Name, Value)Inputs
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
X | NumericArray | Yes | — | Integer symbols or grouped bit input. |
M | NumericScalar | Yes | — | Modulation order greater than one. |
args | Any | Variadic | — | Optional phase offset, symbol order, and name-value options. |
Returns
| Name | Type | Description |
|---|---|---|
Y | NumericArray | Complex M-PSK baseband samples. |
Errors
| Identifier | When | Message |
|---|---|---|
| — | Symbols, modulation order, phase, mapping, or options are invalid. | pskmod: invalid argument |
How pskmod works
Xmust contain finite integer symbols in the inclusive range[0, M-1]whenInputTypeis'integer'.Mmust be an integer greater than one. Bit input additionally requiresMto be a power of two. MATLAB-compatible calls supply this control as a double; typed-integerMis available inrunmatcompatibility mode.- The default phase offset is zero radians. MATLAB-compatible calls supply an explicit phase offset as a double; a typed-integer phase offset is available in
runmatcompatibility mode. - The default symbol order is
'gray';'bin'maps symbolkto anglephaseoffset + 2*pi*k/M. - Custom symbol order vectors must have length
M, contain each integer in[0, M-1]exactly once, and label constellation points counter-clockwise starting atphaseoffset. Integer-valued double vectors are MATLAB-compatible controls; typed-integer custom-order vectors are available inrunmatcompatibility mode. InputType='bit'groups rows bylog2(M)bits per symbol with the first bit as the MSB, preserving remaining dimensions as independent channels.OutputDataType='single'rounds real and imaginary samples through single precision before returning the complex tensor or resident complex gpuArray output.PlotConstellation=trueis accepted as a recognized option but raises an explicit not-implemented error.
Does RunMat run pskmod on the GPU?
RunMat represents complex GPU tensors as interleaved real/imaginary buffers with complex storage metadata, so downstream GPU-aware FFT and signal paths can consume the modulation output without a host result.
The provider hooks receive a validated constellation table and write the complex output on device. They read back only a compact validation state for MATLAB-compatible symbol or bit errors.
GPU memory and residency
The builtin declares NewHandle residency for gpuArray inputs. Integer-symbol and bit-input gpuArray inputs stay resident through provider-side constellation modulation and produce a complex-interleaved GPU handle when provider support is available.
Examples
Default 8-PSK Gray mapping
y = pskmod(0:7, 8)QPSK with a phase offset
y = pskmod(0:3, 4, pi/4)Binary symbol ordering
y = pskmod(0:3, 4, 0, 'bin')Bit input
bits = [0 0; 0 1; 1 0; 1 1];
y = pskmod(bits, 4, InputType='bit')Using pskmod with coding agents
Open a RunMat example with live inputs, then ask the agent to explain how pskmod changes the result.
Run a small pskmod example, explain the result, then change one input and compare the output.
FAQ
Does pskmod execute on the GPU?⌄
Yes when the active provider implements the modulation hooks. Integer-symbol and bit-input gpuArrays can produce resident complex-interleaved outputs directly.
Is custom symbol ordering supported?⌄
Yes. Supply a vector whose first element labels the constellation point at phaseoffset; later elements label points counter-clockwise around the unit circle.
Related Comms functions
Open-source implementation
Unlike proprietary runtimes, every RunMat function is open-source. Read exactly how pskmod is executed, line by line, in Rust.
- View the source for pskmod in Rust on GitHub
- Learn how the RunMat runtime works
- Found a bug? Open an issue with a minimal reproduction.
About RunMat
RunMat is an open-source runtime that executes MATLAB-syntax code blazing on any GPU. It is licensed under the Apache 2.0 license.
- RunMat automatically optimizes your math for GPU execution on Apple, Nvidia, and AMD hardware. No code changes needed. Simulations that took hours now take minutes.
- Start running code in seconds. RunMat runs in the browser, on the desktop, or from the CLI. No license server, no IT ticket.