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
    • damp
    • db
    • dcgain
    • feedback
    • impulse
    • isstable
    • lqr
    • nyquist
    • pole
    • pzmap
    • rlocus
    • ss
    • step
    • stepinfo
    • tf
    • zero

db — Convert numeric values to decibels in MATLAB and RunMat.

Y = db(X) converts magnitudes to decibels using voltage form 20*log10(abs(X)). db(X, 'power') uses power form 10*log10(abs(X)), and db(X, R) applies resistance-based voltage conversion under MATLAB semantics.

Syntax

yDb = db(y)
yDb = db(y, "voltage")
yDb = db(y, "power")
yDb = db(y, R)

Inputs

NameTypeRequiredDefaultDescription
yAnyYes—Input signal magnitude or power quantity.
modeOrRAnyNo"voltage"Mode string ('voltage' or 'power') or resistance reference.

Returns

NameTypeDescription
yDbNumericArrayDecibel-converted output.

Errors

IdentifierWhenMessage
RunMat:db:InvalidArgumentInputs do not match supported db invocation forms.db: invalid argument
RunMat:db:InvalidModeMode string is not recognized or is not a scalar text value.db: invalid mode
RunMat:db:InvalidInputInput signal cannot be interpreted as numeric magnitude data.db: invalid input
RunMat:db:InvalidResistanceResistance reference is non-numeric, complex, non-finite, or non-positive.db: invalid resistance
RunMat:db:SizeMismatchSignal and resistance inputs are not broadcast compatible.db: array sizes are not compatible for broadcasting
RunMat:db:InternalInternal tensor conversion or allocation failed.db: internal error

How db works

  • db(X) and db(X, 'voltage') compute voltage-style decibels with 20*log10(abs(X)).
  • db(X, 'power') computes power-style decibels with 10*log10(abs(X)).
  • db(X, R) computes power through a finite positive resistance with 10*log10(abs(X).^2 ./ R).
  • Complex inputs are converted through their magnitude before applying the decibel formula.
  • The resistance form supports MATLAB implicit expansion between X and R.
  • Zero input returns -Inf, matching the logarithm singularity at zero.
  • MATLAB-compatible computation inputs use single or double; voltage input may also be floating complex. Integer, logical, complex-integer, and typed-integer resistance inputs are promoted to double only in runmat compatibility mode.

Examples

Voltage-style decibel conversion

y = db(10)

Expected output:

y = 20

Power-style decibel conversion

p = db(100, 'power')

Expected output:

p = 20

Voltage across a reference resistance

p = db(10, 50)

Expected output:

p = 3.0103

Complex magnitude conversion

z = db(3 + 4i)

Expected output:

z = 13.9794

Using db with coding agents

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

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

FAQ

What is the default mode?⌄

The default is voltage mode, equivalent to db(X, 'voltage').

How does db handle complex values?⌄

RunMat first computes abs(X) and then applies the selected decibel formula, so complex outputs are not produced.

What happens for zero input?⌄

db(0) returns -Inf because log10(0) is negative infinity.

Can resistance be an array?⌄

Yes. The resistance form broadcasts X and R using MATLAB implicit expansion. Resistance values must be finite and positive.

Related Control functions

damp · dcgain · feedback · impulse · isstable · lqr · nyquist · pole · pzmap · rlocus · ss · step · stepinfo · tf · zero

Open-source implementation

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

  • View the source for db 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 db works
  • Examples
  • Voltage-style decibel conversion
  • Power-style decibel conversion
  • Voltage across a reference resistance
  • Complex magnitude conversion
  • Using db with coding agents
  • FAQ
  • Related Control functions
  • Open-source implementation
  • About RunMat