freqz

Compute digital filter frequency response values.

Syntax

h = freqz(b,a,f,fs)

Inputs

b
The numerator polynomial coefficients of the filter.
Type: double
Dimension: vector
a
The denominator polynomial coefficients of the filter.
Type: double
Dimension: vector
f
The frequencies (in Hz) at which the response is computed.
Type: double
Dimension: scalar | vector
fs
The sampling frequency (in Hz).
Type: double
Dimension: scalar

Outputs

h
The frequency response values.
Type: complex
Dimension: vector

Example

Verify the cutoff frequency of a fourth order Butterworth low pass digital filter with a 300 Hz cutoff frequency and a 1000 Hz sampling frequency.

b = [0.16718, 0.66872, 1.0031, 0.66872, 0.16718];
a = [1, 0.7821, 0.67998, 0.18268, 0.030119];
h = freqz(b,a,300,1000);
abs(h)
ans = 0.70715

Comments

A warning is issued if values of f exceed the Nyquist frequency.