b = fircband(n,f,a,w,c)
designs filters having constrained error magnitudes (ripples) using the minimax filter
design algorithm.

b = fircband(n,f,a,s)
is used to design filters with special properties at certain frequency points specified by
s.

b = fircband(___,'1')
designs a type 1 filter (even-order symmetric). You can also specify type 2 (odd-order
symmetric), type 3 (even-order antisymmetric), or type 4 (odd-order antisymmetric) filters.
Note there are restrictions on a at f = 0 or
f = 1 for types 2, 3, and 4.

b = fircband(___,'minphase')
designs a minimum-phase FIR filter. You can also specify 'maxphase'.

b = fircband(___, 'check')
produces a warning when there are potential transition-region anomalies in the filter
response.

b = fircband(___,{lgrid}),
where {lgrid} is a scalar cell array containing an integer, controls
the density of the frequency grid.

[b,err] = fircband(___)
returns the unweighted approximation error magnitudes. err has one
element for each independent approximation error.

[b,err,res] = fircband(___)
returns a structure res of optional results computed by
fircband.

Using fvtool to display the result b shows you the response of the filter you designed.

fvtool(b)

Design two filters of different order with the stopband constrained to 60 dB. Use excess order (80) in the second filter to improve the passband ripple.

n — Filter order integer greater than or equal to 3

Filter order, specified as an integer greater than or equal to 3.

f — Normalized frequency points real-valued vector

Normalized frequency points, specified as a real-valued vector. The argument must be
in the range [0, 1] , where 1 corresponds to the Nyquist frequency. The number of
elements in the vector is always a multiple of 2. The frequencies must be in increasing
order.

a — Desired amplitude vector

Desired amplitudes at the points specified in f, specified as a
vector. f and a must be of the same length. The
length must be an even number.

w — Weights real-valued vector

Weights used to adjust the fit in each frequency band, specified as a real-valued
vector. The length of w is half the length of
f and a, so there is exactly one weight per
band.

c — Constrained error magnitudes (ripples) cell array of character vectors | array of strings

Constrained error magnitudes (ripples), specified as a cell array of character
vectors or an array of strings. c must have the same length as
w.

The entries of c must be either:

'c' or "c" –– To indicate that the
corresponding element in w is a constraint (the ripple for
that band cannot exceed that value).

'w' or "w" –– To indicate that the
corresponding entry in w is a weight.

There must be at least one unconstrained band — c must
contain at least one w entry. For instance, the Design a Constrained Lowpass Filter
example uses a weight of 1 in the passband, and constrains the
stopband ripple not to exceed 0.2 (about 14 dB).

Note

If your constrained filter does not touch the constraints, increase the error
weighting you apply to the unconstrained bands.

Note

When you work with constrained stopbands, enter the stopband constraint according
to the standard conversion formula for power — the resulting filter attenuation
or constraint equals 20*log(constraint) where
constraint is the value you enter in the function. For example,
to set 20 dB of attenuation, use a value for the constraint equal to 0.1. This applies
to constrained stopbands only.

Data Types: char | string

s — Special properties at certain frequency points cell array of character vectors | array of strings

Special properties at certain frequency points, specified as a cell array of
character vectors or an array of strings. s must have the same
length as f and a. Entries of
s must be one of:

'n' or "n" — Normal frequency
point.

's' or "s" — Single-point band. The
frequency “band” is given by a single point. Specify the corresponding
gain at this frequency point in a.

'f' or "f" — Forced frequency
point. Forces the gain at the specified frequency band to be the value
specified.

'i' or "i" — Indeterminate
frequency point. Use this argument when adjacent bands abut one another (no
transition region).

Data Types: char | string

lgrid — Density of frequency grid 16 (default) | 1-by-1 cell array with integer value

Control the density of the frequency grid, which has roughly
(lgrid*n)/(2*bw) frequency points, where bw is
the fraction of the total frequency band interval [0,1] covered by f.
Increasing lgrid often results in filters that more exactly match an
equiripple filter, but that take longer to compute. The default value of
16 is the minimum value that should be specified for
lgrid.

Unweighted approximation error magnitudes, returned as a scalar or a vector.
err contains one element for each independent approximation error
returned by the function.

res — Frequency response characteristics structure

Frequency response characteristics, returned as a structure. The structure
res has the following fields:

Structure Field

Contents

res.fgrid

Vector containing the frequency grid used in the filter design
optimization

res.des

Desired response on fgrid

res.wt

Weights on fgrid

res.h

Actual frequency response on the frequency grid

res.error

Error at each point (desired response - actual response) on the
frequency grid

res.iextr

Vector of indices into fgrid of external
frequencies

res.fextr

Vector of extremely frequencies

res.order

Filter order

res.edgecheck

Transition-region anomaly check. One element per band edge. Element
values have the following meanings: 1 = OK , 0 = probable transition-region
anomaly , -1 = edge not checked. Computed when you specify the
'check' input option in the function
syntax.

res.iterations

Number of Remez iterations for the optimization

res.evals

Number of function evaluations for the optimization

You can also select a web site from the following list:

How to Get Best Site Performance

Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.