RunMat
  • Pricing
RunMat
GitHub
GitHub
DownloadSign InTry in Browser
DesktopRuntimeServer
RunMat

Run math blazing fast

GitHubX (Twitter)LinkedIn

Company

  • About
  • Pricing
  • Contact

Explore

  • RunMat for academia
  • RunMat vs MATLAB Online
  • Benchmarks

Get product updates and release notes from the RunMat team.

© 2026 Dystr · Made withfor the scientific community.

RunMat™ is a registered trademark of Dystr, Inc. MATLAB® is a registered trademark of The MathWorks, Inc. RunMat is not affiliated with, endorsed by, or sponsored by The MathWorks, Inc.

LicensePrivacy
/
See all docs
Builtin Reference
    • blackman
    • butter
    • buttord
    • cheb2ord
    • conv
    • conv2
    • deconv
    • downsample
    • envelope
    • filter
    • filtfilt
    • fir1
    • freqz
    • gauspuls
    • hamming
    • hann
    • hilbert
    • periodogram
    • pulstran
    • pwelch
    • rectpuls
    • resample
    • sawtooth
    • sinc
    • spectrogram
    • square
    • tripuls
    • unwrap
    • upsample
    • zplane

hilbert — Construct analytic signals with the Hilbert transform.

z = hilbert(x) returns the analytic signal associated with x. For complex single/double input, the imaginary part is ignored before the transform. Integer/logical signal data, typed or logical lengths, zero or empty lengths, and inputs beyond matrices are RunMat extensions.

Syntax

z = hilbert(x)
z = hilbert(x, N)

Inputs

NameTypeRequiredDefaultDescription
xNumericArrayYes—Real-valued signal vector, matrix, or N-D array.
NNumericScalarNo[]FFT length along the first non-singleton dimension.

Returns

NameTypeDescription
zNumericArrayAnalytic signal with real part equal to the input signal.

Errors

IdentifierWhenMessage
RunMat:hilbert:ArgCountMore than two input arguments are supplied.hilbert: expected hilbert(X) or hilbert(X, N)
RunMat:hilbert:InvalidLengthLength argument N is non-scalar, negative, non-finite, or fractional.hilbert: invalid length argument
RunMat:hilbert:InvalidInputInput cannot be converted to a real numeric/logical signal.hilbert: expected real numeric input
RunMat:hilbert:InternalFFT execution or tensor shaping fails internally.hilbert: internal error

How hilbert works

  • Accepts documented single/double vectors and matrices; integer, logical, and N-D inputs require RunMat extension mode.
  • Operates along the first non-singleton dimension, matching MATLAB's column-wise behavior for matrices and row-wise behavior for row vectors.
  • hilbert(x, N) pads with zeros or truncates along the transform dimension before constructing the analytic signal.
  • Returns complex scalar or complex tensor output; output shape follows the input shape except that the transform dimension becomes N when supplied.
  • The FFT-domain multiplier preserves DC and, for even lengths, Nyquist bins; positive-frequency bins are doubled and negative-frequency bins are zeroed.
  • For complex single/double input, the imaginary component is ignored and the real component is transformed.

Does RunMat run hilbert on the GPU?

The WGPU provider computes FFT, analytic-signal weighting, and inverse FFT without gathering the source tensor to host.

The output handle is marked as complex-interleaved GPU storage for downstream resident complex operations.

If the provider hook is unavailable or the requested transform length is zero, the runtime gathers and uses the MATLAB-compatible host FFT implementation.

GPU memory and residency

hilbert keeps real GPU tensors resident when the active provider implements signal_hilbert, returning a complex-interleaved GPU tensor. An explicitly unsupported hook uses a non-destructive owner download and restores the complex result when the owner can preserve its precision; the source handle remains resident.

Examples

Analytic signal of a sampled cosine

x = [1 0 -1 0];
z = hilbert(x)

Expected output:

z = [1.0000 + 0.0000i, 0.0000 + 1.0000i, -1.0000 + 0.0000i, 0.0000 - 1.0000i]

Use Hilbert output for phase demodulation

fs = 8000;
t = 0:1/fs:0.1;
s = cos(2*pi*500*t + 2*sin(2*pi*20*t));
z = hilbert(s);
phase = unwrap(angle(z));

Specify an FFT length

x = [1 0 -1 0];
z = hilbert(x, 8);
size(z)

Expected output:

ans = [1 8]

Operate down matrix columns

X = [1 0; 0 1; -1 0; 0 -1];
Z = hilbert(X);

Using hilbert with coding agents

Open a RunMat example with live inputs, then ask the agent to explain how hilbert changes the result.

Run a small hilbert example, explain the result, then change one input and compare the output.

FAQ

What does hilbert return?⌄

hilbert returns an analytic signal. Its real part is the input signal and its imaginary part is the Hilbert transform.

Which dimension is transformed?⌄

RunMat follows MATLAB's default: the first non-singleton dimension. For a column vector this is rows, for a row vector this is columns, and for a matrix this means each column is transformed independently.

How is the transform computed?⌄

RunMat computes an FFT, applies the standard one-sided analytic-signal multiplier, and then computes an inverse FFT.

Can I pass complex input?⌄

Yes for single and double input. MATLAB-compatible behavior ignores the input's imaginary component, transforms its real component, and returns the complex analytic signal. Typed complex-integer input is not supported.

Does hilbert run on GPU tensors?⌄

Yes. Providers with signal_hilbert support keep real GPU tensor inputs resident and return a complex GPU tensor. An explicitly unsupported hook downloads non-destructively through the input owner, computes on the host, and restores the result to that owner when its precision can be preserved.

Related Math functions

Signal

blackman · butter · buttord · cheb2ord · conv · conv2 · deconv · downsample · envelope · filter · filtfilt · fir1 · freqz · gauspuls · hamming · hann · periodogram · pulstran · pwelch · rectpuls · resample · sawtooth · sinc · spectrogram · square · tripuls · unwrap · upsample · zplane

Elementwise

abs · angle · bsxfun · complex · conj · double · erf · erfcinv · exp · expm1 · factorial · flintmax · gamma · gammaln · heaviside · hypot · idivide · imag · intmax · intmin · ldivide · log · log10 · log1p · log2 · minus · nextpow2 · plus · pow2 · power · rdivide · real · realmax · realmin · realsqrt · rescale · sign · single · sqrt · swapbytes · times · typecast · uint16 · uint32 · uint8

Trigonometry

acos · acosh · asin · asinh · atan · atan2 · atanh · cos · cosd · cosh · cospi · deg2rad · pol2cart · rad2deg · sin · sind · sinh · sinpi · tan · tand · tanh

Reduction

all · any · bounds · cummax · cummin · cumprod · cumsum · cumtrapz · diff · gradient · max · maxk · mean · median · min · mink · movmax · movmean · movmedian · movmin · movprod · movstd · movsum · movvar · nnz · prod · rms · std · sum · trapz · var

Structure

bandwidth · isdiag · ishermitian · issymmetric · istril · istriu · symrcm

Rounding

ceil · fix · floor · mod · rem · round

Factor

chol · decomposition · eig · eigs · lu · qr · svd

Solve

cond · det · inv · linsolve · norm · null · pinv · rank · rcond · rref · vecnorm

Optim

coneprog · fminbnd · fminunc · fsolve · fzero · integral · linprog · lsqcurvefit · lsqnonlin · optimoptions · optimset · quad · secondordercone

Ops

cross · ctranspose · dot · mldivide · mpower · mrdivide · mtimes · pagemtimes · pagetranspose · trace · transpose

Symbolic

digits · int · limit · piecewise · sym · syms · vpa

Fft

fft · fft2 · fftn · fftshift · ifft · ifft2 · ifftn · ifftshift

Interpolation

griddedInterpolant · interp1 · interp1q · interp2 · pchip · ppval · spline

Discrete

lcm · primes

Ode

ode15s · ode23 · ode45

Poly

polyder · polyfit · polyint · polyval · roots

Open-source implementation

Unlike proprietary runtimes, every RunMat function is open-source. Read exactly how hilbert is executed, line by line, in Rust.

  • View the source for hilbert 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.

Getting started · Benchmarks · Pricing

Download RunMat

Download RunMat for full performance, or use RunMat in your browser for zero setup.

Download RunMatOpen Sandbox
On this page
  • Syntax
  • Inputs
  • Returns
  • Errors
  • How hilbert works
  • Does RunMat run hilbert on the GPU?
  • GPU memory and residency
  • Examples
  • Analytic signal of a sampled cosine
  • Use Hilbert output for phase demodulation
  • Specify an FFT length
  • Operate down matrix columns
  • Using hilbert with coding agents
  • FAQ
  • Related Math functions
  • Signal
  • Elementwise
  • Trigonometry
  • Reduction
  • Structure
  • Rounding
  • Factor
  • Solve
  • Optim
  • Ops
  • Symbolic
  • Fft
  • Interpolation
  • Discrete
  • Ode
  • Poly
  • Open-source implementation
  • About RunMat