Products & Services Solutions Academia Support User Community Company

Learn more about Filter Design Toolbox   

freqz - Frequency response of filter

Syntax

[h,w] = freqz(ha)
[h,w] = freqz(ha,n)
freqz(ha)
[h,w] = freqz(hd)
[h,w] = freqz(hd,n)
freqz(hd)
[h,w] = freqz(hm)
[h,w] = freqz(hd,n)
freqz(hd)

Description

The next sections describe common freqz operation with adaptive, discrete-time, and multirate filters. For more input options, refer to freqz in Signal Processing Toolbox documentation.

Adaptive Filters

For adaptive filters, freqz returns the instantaneous frequency response based on the current filter coefficients.

[h,w] = freqz(ha) returns the frequency response vector h and the corresponding frequency vector w for the adaptive filter ha. When ha is a vector of adaptive filters, freqz returns the matrix h. Each column of h corresponds to one filter in the vector ha.

[h,w] = freqz(ha,n) returns the frequency response vector h and the corresponding frequency vector w for the adaptive filter ha. freqz uses the transfer function associated with the adaptive filter to calculate the frequency response of the filter with the current coefficient values. The vectors h and w are both of length n. The frequency vector w has values ranging from 0 to π radians per sample. If you do not specify the integer n, or you specify it as the empty vector [], the frequency response is calculated using the default value of 8192 samples for the FFT.

freqz(ha) uses FVTool to plot the magnitude and unwrapped phase of the frequency response of the adaptive filter ha. If ha is a vector of filters, freqz plots the magnitude response and phase for each filter in the vector.

Discrete-Time Filters

[h,w] = freqz(hd) returns the frequency response vector h and the corresponding frequency vector w for the discrete-time filter hd. When hd is a vector of discrete-time filters, freqz returns the matrix h. Each column of h corresponds to one filter in the vector hd.

[h,w] = freqz(hd,n) returns the frequency response vector h and the corresponding frequency vector w for the discrete-time filter hd. freqz uses the transfer function associated with the discrete-time filter to calculate the frequency response of the filter with the current coefficient values. The vectors h and w are both of length n. The frequency vector w has values ranging from 0 to π radians per sample. If you do not specify the integer n, or you specify it as the empty vector [], the frequency response is calculated using the default value of 8192 samples for the FFT.

freqz(hd) uses FVTool to plot the magnitude and unwrapped phase of the frequency response of the adaptive filter hd. If hd is a vector of filters, freqz plots the magnitude response and phase for each filter in the vector.

Multirate Filters

[h,w] = freqz(hm) returns the frequency response vector h and the corresponding frequency vector w for the multirate filter hd. When hd is a vector of multirate filters, freqz returns the matrix h. Each column of h corresponds to one filter in the vector hd.

[h,w] = freqz(hd,n) returns the frequency response vector h and the corresponding frequency vector w for the multirate filter hd. freqz uses the transfer function associated with the multirate filter to calculate the frequency response of the filter with the current coefficient values. The vectors h and w are both of length n. The frequency vector w has values ranging from 0 to π radians per sample. If you do not specify the integer n, or you specify it as the empty vector [], the frequency response is calculated using the default value of 8192 samples for the FFT.

freqz(hd) uses FVTool to plot the magnitude and unwrapped phase of the frequency response of the adaptive filter hd. If hd is a vector of filters, freqz plots the magnitude response and phase for each filter in the vector.

Remarks

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.

Algorithm

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.

Examples

Plot the estimated frequency response of a filter. This example uses discrete-time filters, but any adaptfilt, dfilt, or mfilt object would work. First plot the results for one filter.

b = fir1(80,0.5,kaiser(81,8));
hd = dfilt.dffir(b);
freqz(hd);

If you have more than one filter, you can plot them on the same figure using a vector of filters.

b = fir1(40,0.5,kaiser(41,6));
hd2 = dfilt.dffir(b);
h = [hd hd2];
freqz(h);

See Also

adaptfilt, dfilt, mfilt

fvtool in Signal Processing Toolbox documentation

  


Free Early Verification Kit

Learn how to apply early verification to your development process through these technical resources.

How much time do you spend on testing to ensure implementation meets system-level requirements?

 © 1984-2009- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS