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

fir1 — Design windowed-sinc FIR filters.

fir1(n, Wn) designs an order-n FIR filter using a Hamming-windowed sinc response. Scalar Wn creates a low-pass filter by default; a two-element Wn creates a band-pass filter by default. Add a filter type string for high-pass or stop-band designs.

Syntax

b = fir1(n, Wn)
b = fir1(n, Wn, ftype)
b = fir1(n, Wn, ftype, window, scaleopt)

Inputs

NameTypeRequiredDefaultDescription
nSizeArgYes—Filter order.
WnAnyYes—Normalized cutoff frequency or two-element band.
optionAnyVariadic—Filter type, window vector, or scale/noscale option.

Returns

NameTypeDescription
bNumericArrayFIR numerator coefficient row vector.

Errors

IdentifierWhenMessage
RunMat:fir1:ArgCountFewer than two arguments are supplied.fir1: expected fir1(n, Wn, ...)
RunMat:fir1:InvalidOrderThe order is not a finite nonnegative integer scalar.fir1: filter order must be a nonnegative integer
RunMat:fir1:InvalidFrequencyWn is not a valid normalized scalar or increasing two-element band.fir1: invalid cutoff frequency
RunMat:fir1:InvalidOptionA filter type, window vector, or scaling option is unsupported.fir1: invalid option
RunMat:fir1:InternalCoefficient materialization fails internally.fir1: internal error

How fir1 works

  • Returns a row vector with n + 1 coefficients.
  • Wn uses MATLAB's normalized digital convention where 1 is Nyquist.
  • Supported filter types are low, high, bandpass, and stop.
  • A custom window vector of length n + 1 may be supplied.
  • Filters are scaled by default; pass noscale to skip passband normalization.

Does RunMat run fir1 on the GPU?

Resident numeric arguments currently gather for host-side coefficient design.

The result is currently a host double row vector; documented GPU output residency is not yet restored.

Examples

Design a low-pass FIR filter

b = fir1(4, 0.5);
fprintf('%d %.4f\n', length(b), sum(b));

Expected output:

5 1.0000

Design coefficients for a FIR low-pass response plot

fs = 1000;
fc = 100;
N = 51;
wn = fc / (fs/2);
b = fir1(N-1, wn, 'low');
[H, w] = freqz(b, 1, 512, fs);
fprintf('%d %.1f %.1f\n', length(b), w(1), w(end));

Expected output:

51 0.0 499.0

Use a custom rectangular window without scaling

w = ones(1, 11);
b = fir1(10, 0.3, w, 'noscale');

Using fir1 with coding agents

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

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

FAQ

What window does fir1 use by default?⌄

RunMat uses a symmetric Hamming window, matching MATLAB's default FIR design workflow.

Can the coefficients be used with filtfilt?⌄

Yes. Use filtfilt(b, 1, x) for zero-phase FIR filtering.

Does fir1 run on the GPU?⌄

The current implementation gathers resident numeric arguments and returns host double coefficients. Returning the documented resident GPU result remains a tracked compatibility gap.

Related Math functions

Signal

blackman · butter · buttord · cheb2ord · conv · conv2 · deconv · downsample · envelope · filter · filtfilt · 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 fir1 is executed, line by line, in Rust.

  • View the source for fir1 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 fir1 works
  • Does RunMat run fir1 on the GPU?
  • Examples
  • Design a low-pass FIR filter
  • Design coefficients for a FIR low-pass response plot
  • Use a custom rectangular window without scaling
  • Using fir1 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