This program plots filter responses. The program takes as input a filter specification in [b,a] (numerator, denominator polynomials) form. It offers a number of different types of frequency response plots.
• log: Log amplitude plot with a limited dynamic range.
• log-radian: Log plot as above, with frequency axis labeled with normalized radian frequency.
• linear: Linear amplitude response.
• linear-radian: Linear plot as above, with the frequency axis labeled with normalized radian frequency.
• real: Linear plot of the real part of the response. The frequency response is decomposed into the product of a phase factor (the phase can be non-linear) and a real factor. The real factor (can be both positive and negative) is plotted.
• real-radian: Linear plot of the real part, with the frequency axis labeled with normalized radian frequency.
• phase: Plot of the unwrapped phase factor. This is the phase factor that accompanies the real factor (see above).
• phase-radian: Plot of the phase factor, with the frequency axis labeled in normalized radian frequency.
• delay: Plot of the group delay (derivative of the phase response).
• delay-radian: Plot of the group delay, with the frequency axis labeled in normalized radian frequency.
• The frequency response is first calculated on a dense frequency grid. The frequency evaluation points are readjusted to coincide more closely with the local extrema of the response. In this way, zeros and maxima of the response are better reproduced and the envelope of the frequency response is shown correctly.
• For log amplitude plots, the amplitude range is chosen so that upper limit of the range is a multiple of 10 or 20 dB. The dynamic range is limited to be no more than 100 dB. The actual range depends on the number of filter coefficients.
• The number of plot points is reduced by eliminating points in regions in which the plot is smooth. In this way, the dense frequency grid is usually reduced to a very much smaller number of points without affecting the appearance. The critical regions of the plot are reproduced without change.
• The axis ticks are chosen using a custom algorithm which ensures that the number of labeled ticks is reasonable. An additional overlay is created so that shorter length ticks are created between the labeled ticks. In this way, we create axes with labels which are not overly crowded.
• The plots with radian labels are created by turning off normal labels and generating custom labels which include the pi designations.
h = hamming(120);
PlotFilter(h, 1, 'log-radian');
Filter Coefficient Files:
The filter files included in this package have the coefficients in ASCII. A header indicates the type of file and documents the design parameters. The routine ReadFilter reads the coefficient files and returns the filter transfer function in a form usable by PlotFilter and other Matlab filtering routines.
ITU-T Software Tools Library:
The ITU-T document “Software Tool Library”  has C-language routines for filtering speech and audio files. In these routines, the filter coefficients are imbedded in the code. The filter files included in this package have the coefficients extracted from the C-code. The filter files taken from the Software Tools Library have the prefix STL.
TIA Speech Coder Filter Files:
This package also includes filters used by the TIA in their speech coding standards. These filters have the prefix TIA and the name of the standard in the coefficient file name.
Quadrature Mirror Filters:
The Johnston Quadrature Mirror Filters  are included in this package. The notation for the filter coefficient files follows that in the original paper, e.g. QMF_16B.cof is a 16 coefficient QMF filter with transition band of type B.
[b, a] = ReadFilter('Filters/STL/STL_G712_IIR_16k.cof');
Fs = 16000;
PlotFilter (b, a, Fs);
1. ITU-T, “Software Tool Library for Speech and Audio Coding Standardization”, Recommendation G.191, Sept. 2005 (on-line at http://www.itu.int/rec/T-REC-g)
2. J. D. Johnston, “A Filter Family Designed for Use in Quadrature Mirror Filter Banks”, Proc. IEEE Int. Conf. Acoustics, Speech, Signal Processing (Denver, CO), pp. 291–294, April 1980.
Peter Kabal (2021). PlotFilter / Filter Coefficient Files (https://www.mathworks.com/matlabcentral/fileexchange/24331-plotfilter-filter-coefficient-files), MATLAB Central File Exchange. Retrieved .
Find the treasures in MATLAB Central and discover how the community can help you!Start Hunting!