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

buttord — Select the minimum Butterworth filter order.

buttord(Wp, Ws, Rp, Rs) computes the minimum Butterworth filter order and natural cutoff Wn that satisfy passband ripple Rp and stopband attenuation Rs. Digital frequencies use MATLAB's normalized convention where 1 is Nyquist; add 's' for analog rad/s designs.

Syntax

[n, Wn] = buttord(Wp, Ws, Rp, Rs)
[n, Wn] = buttord(Wp, Ws, Rp, Rs, 's')

Inputs

NameTypeRequiredDefaultDescription
WpNumericArrayYes—Passband edge or two-element passband edge vector.
WsNumericArrayYes—Stopband edge or two-element stopband edge vector.
RpNumericScalarYes—Maximum passband ripple in dB.
RsNumericScalarYes—Minimum stopband attenuation in dB.
WpNumericArrayYes—Analog passband edge or edge pair in rad/s.
WsNumericArrayYes—Analog stopband edge or edge pair in rad/s.
sStringScalarYes—Analog-design selector.

Returns

NameTypeDescription
nNumericScalarMinimum Butterworth filter order.
WnNumericArrayNatural cutoff frequency or frequency pair for butter.

Returned values from buttord depend on how many outputs the caller requests.

Errors

IdentifierWhenMessage
RunMat:buttord:ArgCountThe argument count is outside supported forms.buttord: expected buttord(Wp, Ws, Rp, Rs [, 's'])
RunMat:buttord:InvalidFrequencyPassband or stopband edges are invalid.buttord: invalid passband or stopband frequency
RunMat:buttord:InvalidAttenuationRipple or attenuation values are invalid.buttord: Rp and Rs must be positive finite scalars with Rs > Rp
RunMat:buttord:InvalidOptionThe optional selector is not supported.buttord: optional selector must be 's'
RunMat:buttord:TooManyOutputsMore than two output arguments are requested.buttord: too many output arguments
RunMat:buttord:InternalOutput tensor construction fails internally.buttord: internal error

How buttord works

  • [n, Wn] = buttord(Wp, Ws, Rp, Rs) returns a double scalar with an integral value for n and double cutoff Wn for direct use with the documented double-only butter(n, Wn) interface.
  • Scalar Wp and Ws select lowpass when Wp < Ws and highpass when Wp > Ws.
  • Two-element edge vectors select bandpass when the stopband encloses the passband and bandstop when the passband encloses the stopband.
  • Digital inputs must be finite, positive, and less than 1. RunMat currently requires analog inputs to be finite and positive.
  • Rs must be greater than Rp, and both values are specified in decibels.
  • Documented inputs are real single or double. RunMat mode additionally admits independently gated typed-integer frequency and attenuation roles, logical roles, zero-imaginary complex frequency edges, and resident arguments; all cross explicit binary64 analysis boundaries and return host double values.
  • MATLAB documents infinite passband or stopband edges for analog designs. RunMat's shared order-selection validator currently rejects nonfinite edges, so that non-integer compatibility gap remains open.

Examples

Lowpass order selection

[n, Wn] = buttord(0.2, 0.3, 1, 40);
[b, a] = butter(n, Wn);

Highpass order selection

[n, Wn] = buttord(0.5, 0.3, 1, 40);
[b, a] = butter(n, Wn, 'high');

Bandpass order selection

[n, Wn] = buttord([0.3 0.5], [0.2 0.6], 1, 30);
[b, a] = butter(n, Wn, 'bandpass');

Analog lowpass order selection

[n, Wn] = buttord(10, 20, 1, 40, 's');
[b, a] = butter(n, Wn, 's');

Using buttord with coding agents

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

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

FAQ

What should I pass to butter after buttord?⌄

Pass the returned n and Wn directly. For scalar highpass designs, also pass 'high'; for two-element bandpass or bandstop designs, pass 'bandpass' or 'stop' to match the edge layout.

Does buttord run on the GPU?⌄

The documented API lists code generation but no interactive gpuArray overload. In MATLAB-compatible mode RunMat rejects resident arguments before gather; RunMat mode gathers all four design roles and returns host double order/cutoff values.

Related Math functions

Signal

blackman · butter · 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

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 buttord is executed, line by line, in Rust.

  • View the source for buttord 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 buttord works
  • Examples
  • Lowpass order selection
  • Highpass order selection
  • Bandpass order selection
  • Analog lowpass order selection
  • Using buttord 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