Engee documentation

fircls1

Page in progress.

Calculation of the coefficients of a low- and high-frequency FIR filter with linear phase response using the least squares method with constraints.

Library

EngeeDSP

Syntax

Function call

  • b = fircls1(n,wo,dp,ds) — generates coefficients b FIR low-pass filter with linear phase response length n+1. The amplitude-frequency response of this filter corresponds to the normalized cutoff frequency wo, bandwidth irregularities dp and the unevenness of the delay band ds.

  • b = fircls1(n,wo,dp,ds,wt) — sets the frequency wt so that the amplitude-frequency response of the filter is in the following intervals:

    • [1-dp,1+dp] in the bandwidth if wt located in the bandwidth;

    • [-ds,ds] in the holding lane, if wt He is in the detention area.

  • b = fircls1(n,wo,dp,ds,wp,ws,k) — generates an FIR filter with an L2 weighting function determined by the bandwidth boundary frequency wp, the boundary frequency of the delay band ws and the error rate of calculating the bandwidth to the delay band k.

  • b = fircls1(___, "high") — designs a high-pass FIR filter. Function fircls1 always uses an even filter order for the high-pass filter configuration, since the amplitude-frequency response at the Nyquist frequency is 0 for odd orders. If an odd order is specified n, fircls1 increases it by 1.

  • b = fircls1(___, designDisplay) — defines the parameters for the visual display of the calculation of the filter coefficients.

Arguments

Input arguments

# n — filter order

+ real-valued positive integer scalar

Details

The filter order, specified as a real integer scalar.

Data types

Float32, Float64

# wo is the normalized cutoff frequency

+ real-valued positive scalar

Details

The normalized cutoff frequency, set as a real positive scalar in the range from 0 before 1, where 1 corresponds to the Nyquist frequency.

Data types

Float32, Float64

# dp — unevenness in the bandwidth

+ real-valued positive scalar

Details

The unevenness in the bandwidth, given as a real positive scalar. The unevenness in the bandwidth is the maximum deviation of the bandwidth from 1.

When calculating very narrow-band filters with low dp A filter of the specified order corresponding to the specifications may not exist. In this case, the function returns the calculation of a filter with amplitude-frequency characteristics as close as possible to the specifications. To solve this problem, loosen the calculation constraints or increase the filter order.
Data types

Float32, Float64

# ds — unevenness in the delay band
real-valued positive scalar

Details

The unevenness in the delay band, given as a real positive scalar. The unevenness in the delay band is the maximum deviation of the delay band from 0.

When calculating very narrow-band filters with low ds A filter of the specified order corresponding to the specifications may not exist. In this case, the function returns the calculation of a filter with amplitude-frequency characteristics as close as possible to the specifications. To solve this problem, loosen the calculation constraints or increase the filter order.
Data types

Float32, Float64

# wt is the normalized bandwidth boundary frequency

+ real-valued positive scalar

Details

The normalized bandwidth boundary frequency, defined as a real positive scalar in the range from 0 before 1, where 1 corresponds to the Nyquist frequency.

Setting a normalized bandwidth boundary frequency can help you create one of the following four filter schemes that meet the requirements for a bandwidth boundary or a delay band.:

  • FIR low-pass filter:

    • 0 < wt < wo < 1 — the filter amplitude is within dp from 1 in the frequency range 0 < ω < wt.

    • 0 < wo < wt < 1 — the filter amplitude is within ds from 0 in the frequency range wt < ω < 1.

  • FIR-high-pass filter:

    • 0 < wt < wo < 1 — the filter amplitude is within ds from 0 in the frequency range 0 < ω < wt.

    • 0 < wo < wt < 1 — the filter amplitude is within dp from 1 in the frequency range wt < ω < 1.

Data types

Float32, Float64

# wp is the bandwidth limit frequency of the L2 + weight function real-valued scalar

Details

The bandwidth limit of the L2 weight function, defined as a real scalar. The value of the argument wp it must lie on the border of the bandwidth:

  • wp < wo for low-pass filters;

  • wp > wo for high-pass filters.

Taking into account the actual and required amplitude-frequency characteristics and Accordingly, the error in calculating the L2 bandwidth is

  • for low-pass filters;

  • for high-pass filters.

Data types

Float32, Float64

# ws — the boundary frequency of the delay band of the weight function L2

real-valued scalar

Details

The boundary of the delay band of the weight function L2, defined as a real scalar. The value of the argument wp it must lie on the border of the holding lane:

  • ws > wo for low-pass filters;

  • ws < wo for high-pass filters.

Taking into account the actual and required amplitude-frequency characteristics and Accordingly, the error in calculating the L2 delay band is

  • for low-pass filters;

  • for high-pass filters.

Data types

Float32, Float64

# k is the error coefficient of the L2 calculation in the bandwidth and delay band
real-valued scalar

Details

The error coefficient of the L2 calculation in the bandwidth and delay band, given as a real scalar. Considering the L2 calculation errors in the bandwidth and delay band and , depending on the boundary frequencies wp and ws accordingly, the value of k equally:

Data types

Float32, Float64

# designDisplay — display parameters for calculating filter coefficients

+ "trace" | "plots" | "both"

Details

Display parameters for calculating the filter coefficients, set using one of the following methods:

  • "trace" — display of text information about the calculation error at each iteration step.

  • "plots" — display of a set of graphs showing the amplitude-frequency response of the filter in the entire bandwidth and an enlarged image of the amplitude-frequency response in each section of the bandwidth. The function updates all graphs at each iteration step. The zeros on the graph are the estimated extremes of the new iteration, and the crosses are the estimated extremes of the previous iteration, where the extremes are the peaks (maxima and minima) of the filter ripples.

  • "both" — display of both text information and graphs.

Data types

String

Output arguments

# b — filter coefficients

+ vector string

Details

Filter coefficients returned as a vector string of length n + 1.

Algorithms

Function fircls1 uses an iterative least squares algorithm to obtain an equally probable response. The algorithm is a multiple exchange algorithm using Lagrange multipliers and Kuhn—Tucker conditions at each iteration.

Literature

  1. Selesnick, I. W., M. Lang, and C. S. Burrus. "Constrained Least Square Design of FIR Filters without Specified Transition Bands." Proceedings of the 1995 International Conference on Acoustics, Speech, and Signal Processing. Vol. 2, 1995, pp. 1260–1263.

  2. Selesnick, I. W., M. Lang, and C. S. Burrus. "Constrained Least Square Design of FIR Filters without Specified Transition Bands." IEEE® Transactions on Signal Processing. Vol. 44, Number 8, 1996, pp. 1879–1892.