# firgr

Parks-McClellan FIR filter

## Syntax

## Description

uses a minimax filter design algorithm to design a real linear phase FIR filter
`b`

= firgr(`n`

,`f`

,`a`

,`w`

)`b`

of length `n`

+1. The filter has the best
approximation to the desired frequency response described by `f`

and
`a`

in the minimax sense. `w`

is a vector of weights,
one per band. When you omit `w`

, all bands are weighted equally. For more
information on the input arguments, see `firpm`

.

designs filters repeatedly until the minimum order filter as specified in
`b`

= firgr(`m`

,`f`

,`a`

,`r`

),`m`

and that meets the specifications
`f`

,`a`

is found. `m`

can be one
of '`minorder`

', '`mineven`

' or
'`minodd`

'. `r`

is a vector containing the peak ripple
per frequency band. You must specify `r`

. When you specify
'`mineven`

' or '`minodd`

', the minimum even or odd order
filter is found.

where `b`

= firgr({`m`

,`ni`

},`f`

,`a`

,`r`

)`m`

is one of '`minorder`

',
'`mineven`

' or '`minodd`

', uses `ni`

as the initial estimate of the filter order. `ni`

is optional for common
filter designs, but it must be specified for designs in which `firpmord`

cannot be used, such as while designing differentiators or Hilbert transformers.

specifies independent approximation errors for different bands. Use this syntax to design
extra ripple or maximal ripple filters. These filters have interesting properties such as
having the minimum transition width. `b`

= firgr(`n`

,`f`

,`a`

,`w`

,`e`

)`e`

is a cell array of character
vectors specifying the approximation errors to use. Its length must equal the number of
bands.

specifies weights and independent approximation errors for filters with special properties.
The weights and properties are included in vectors `b`

= firgr(`n`

,`f`

,`a`

,`s`

,`w`

,`e`

)`w`

and
`e`

. Sometimes, you may need to use independent approximation errors to
get designs with forced values to converge. For
example,

b = firgr(82,[0 0.055 0.06 0.1 0.15 1], [0 0 0 0 1 1],... {'n' 'i' 'f' 'n' 'n' 'n'}, [10 1 1] ,{'e1' 'e2' 'e3'});

designs a minimum-phase FIR filter. You can use the argument `b`

= firgr(___,'minphase')`'maxphase'`

to design a maximum phase FIR filter.

`b = firgr(___,'check')`

returns a warning
when there are potential transition-region anomalies.

returns a length `b`

= firgr(`n`

,`f`

,`fresp`

,`w`

)`n`

+ 1 FIR filter which has the best approximation to
the desired frequency response as returned by the user-defined function
* fresp*.

`firgr`

includes a predefined frequency response function named
`'firpmfrf2'`

. You can write your own based on the simpler
`'firpmfrf'`

. See the help for `private/firpmfrf`

for
more information.

`b = firgr(n,f,a,w)`

is
a synonym for `b = firgr(n,f,{'firpmfrf2',a},w)`

,
where `a`

is a vector containing your specified response
amplitudes at each band edge in `f`

. By default, `firgr`

designs
symmetric (even) FIR filters. `'firpmfrf2'`

is the
predefined frequency response function. If you do not specify your
own frequency response function (the `fresp`

variable), `firgr`

uses
'`firpmfrf2'`

.

`b = firgr(___,'h')`

and ```
b =
firgr(__,'d')
```

design antisymmetric (odd) filters. When you omit the
`'h'`

or `'d'`

arguments from the
`firgr`

command syntax, each frequency response function
* fresp* can tell

`firgr`

to design either an
even or odd filter. Use the command syntax ```
sym =
```

`fresp`

`('defaults',{n,f,[],w,p1,p2,...})`

.`firgr`

expects `fresp`

to return ```
sym =
'even'
```

or `sym = 'odd'`

. If `fresp`

does not
support this call, `firgr`

assumes even symmetry.

For more information about the input arguments to `firgr`

, refer to
`firpm`

.

## Examples

## Input Arguments

## Output Arguments

## Extended Capabilities

## Version History

**Introduced in R2011a**