# Documentation

### This is machine translation

Translated by
Mouseover text to see original. Click the button below to return to the English version of the page.

# freqz

Frequency response of filter

## Syntax

```[h,w] = freqz(sysobj) [h,w] = freqz(sysobj,n) [h,w] = freqz(sysobj,Name,Value) freqz(sysobj) ```

## Description

```[h,w] = freqz(sysobj)``` returns the complex frequency response `h` of the filter System object™, `sysobj`. The vector `w` contains the frequencies (in radians) at which the function evaluates the frequency response. The frequency response is evaluated at 8192 points equally spaced around the upper half of the unit circle.

```[h,w] = freqz(sysobj,n)``` returns the complex frequency response of the filter System object and the corresponding frequencies at `n` points equally spaced around the upper half of the unit circle.

`freqz` uses the transfer function associated with the filter to calculate the frequency response of the filter with the current coefficient values.

```[h,w] = freqz(sysobj,Name,Value)``` returns a frequency response with additional options specified by one or more `Name,Value` pair arguments.

`freqz(sysobj)` uses `fvtool` to plot the magnitude and unwrapped phase of the frequency response of the filter System object `sysobj`.

For more information about optional input arguments for `freqz`, refer to `freqz` in Signal Processing Toolbox™ documentation.

## Input Arguments

collapse all

 `sysobj` Filter System object. The following Filter System objects are supported by this analysis function: `dsp.SampleRateConverter` is also supported by `freqz`. `n` Number of samples. For an FIR filter where `n` is a power of two, the computation is done faster using FFTs. Default: 8192

### Name-Value Pair Arguments

Specify optional comma-separated pairs of `Name,Value` arguments. `Name` is the argument name and `Value` is the corresponding value. `Name` must appear inside single quotes (`' '`). You can specify several name and value pair arguments in any order as `Name1,Value1,...,NameN,ValueN`.

collapse all

Specify the arithmetic used during analysis. When you specify `'double'` or `'single'`, the function performs double- or single-precision analysis. When you specify `'fixed'` , the arithmetic changes depending on the setting of the `CoefficientDataType` property and whether the System object is locked or unlocked.

When you do not specify the arithmetic for non-CIC structures, the function uses double-precision arithmetic if the filter System object is in an unlocked state. If the System object is locked, the function performs analysis based on the locked input data type. CIC structures only support fixed-point arithmetic.

## Output Arguments

 `h` Complex `n`-element frequency response vector. If `n` is not specified, the function uses a default value of 8192. `w` Frequency vector of length `n`, in radians/sample. `w` consists of `n` points equally spaced around the upper half of the unit circle (from 0 to π radians/sample). If `n` is not specified, the function uses a default value of 8192.

## Examples

collapse all

This examples plot the frequency response of the lowpass FIR filter using `freqz`.

```b = fir1(80,0.5,kaiser(81,8)); firFilt = dsp.FIRFilter('Numerator',b); freqz(firFilt); ```

## Tips

There are several ways of analyzing the frequency response of filters. `freqz` accounts for quantization effects in the filter coefficients, but does not account for quantization effects in filtering arithmetic. To account for the quantization effects in filtering arithmetic, refer to function `noisepsd`.

## Algorithms

`freqz` calculates the frequency response for a filter from the filter transfer function Hq(z). The complex-valued frequency response is calculated by evaluating Hq(ejω) at discrete values of w specified by the syntax you use. The integer input argument `n` determines the number of equally-spaced points around the upper half of the unit circle at which `freqz` evaluates the frequency response. The frequency ranges from 0 to π radians per sample when you do not supply a sampling frequency as an input argument. When you supply the scalar sampling frequency `fs` as an input argument to `freqz`, the frequency ranges from 0 to `fs`/2 Hz.