freqz — Evaluate digital filter frequency response.
freqz(b, a, n) evaluates the complex frequency response of a digital filter at n points between 0 and Nyquist. With fs, returned frequencies are in Hz instead of radians/sample.
Syntax
freqz(b, a, n)How freqz works
- Default response length is 512 samples.
[H, w] = freqz(...)returns complex responseHand frequency vectorwas column vectors.- Without
fs,wis in radians/sample over[0, pi). - With
fs,wis in Hz over[0, fs/2).
Does RunMat run freqz on the GPU?
Host-side analysis only.
GPU coefficient inputs are gathered before evaluation.
Examples
Evaluate a simple FIR response
[H, w] = freqz([1 1], 1, 4);
fprintf('%.1f %.1f %.4f\n', real(H(1)), imag(H(3)), w(3));Expected output:
2.0 -1.0 1.5708Evaluate a response in Hz
b = fir1(20, 0.25);
[H, f] = freqz(b, 1, 8, 1000);
fprintf('%.1f %.1f\n', f(1), f(end));Expected output:
0.0 437.5Using freqz with coding agents
Open a RunMat example with live inputs, then ask the agent to explain how freqz changes the result.
Run a small freqz example, explain the result, then change one input and compare the output.
FAQ
Does freqz include the Nyquist point?⌄
The supported numeric n form samples n points over [0, pi), matching the common one-sided response grid used by MATLAB's freqz(b,a,n) form.
Can freqz analyze IIR filters?⌄
Yes. Pass numerator b and denominator a; freqz evaluates the transfer function directly on the unit circle.
Related Math functions
Signal
blackman · butter · conv · conv2 · deconv · downsample · filter · filtfilt · fir1 · gauspuls · hamming · hann · hilbert · pulstran · rectpuls · sawtooth · sinc · square · tripuls · unwrap · upsample
Elementwise
abs · angle · complex · conj · double · exp · expm1 · factorial · gamma · heaviside · hypot · imag · ldivide · log · log10 · log1p · log2 · minus · nextpow2 · plus · pow2 · power · rdivide · real · sign · single · sqrt · times
Trigonometry
acos · acosh · asin · asinh · atan · atan2 · atanh · cos · cosd · cosh · deg2rad · rad2deg · sin · sind · sinh · tan · tand · tanh
Reduction
all · any · cummax · cummin · cumprod · cumsum · cumtrapz · diff · gradient · max · mean · median · min · nnz · prod · std · sum · trapz · var
Structure
Open-source implementation
Unlike proprietary runtimes, every RunMat function is open-source. Read exactly how freqz is executed, line by line, in Rust.
- View the source for freqz 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.