Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

remez

Parks-McClellan optimal FIR filter design


Description

Parks-McClellan optimal FIR filter design using the Remez exchange algorithm.

Usage

remez(
  n,
  f,
  a,
  w = rep(1, length(f)/2),
  ftype = c("bandpass", "differentiator", "hilbert"),
  density = 16
)

Arguments

n

filter order (1 less than the length of the filter).

f

normalized frequency points, strictly increasing vector in the range [0, 1], where 1 is the Nyquist frequency. The number of elements in the vector is always a multiple of 2.

a

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

w

vector of weights used to adjust the fit in each frequency band. The length of w is half the length of f and a, so there is exactly one weight per band. Default: 1.

ftype

filter type, matched to one of "bandpass" (default), "differentiatior", or "hilbert".

density

determines how accurately the filter will be constructed. The minimum value is 16 (default), but higher numbers are slower to compute.

Value

The FIR filter coefficients, a vector of length n + 1, of class Ma

Author(s)

Jake Janovetz, janovetz@uiuc.edu,
Paul Kienzle, pkienzle@users.sf.net,
Kai Habel, kahacjde@linux.zrz.tu-berlin.de.
Conversion to R Tom Short
adapted by Geert van Boxtel, G.J.M.vanBoxtel@gmail.com.

References

Rabiner, L.R., McClellan, J.H., and Parks, T.W. (1975). FIR Digital Filter Design Techniques Using Weighted Chebyshev Approximations, IEEE Proceedings, vol. 63, pp. 595 - 610.
https://en.wikipedia.org/wiki/Parks-McClellan_filter_design_algorithm

See Also

Examples

## low pass filter
f1 <- remez(15, c(0, 0.3, 0.4, 1), c(1, 1, 0, 0))
freqz(f1)

## band pass
f <- c(0, 0.3, 0.4, 0.6, 0.7, 1)
a <- c(0, 0, 1, 1, 0, 0)
b <- remez(17, f, a)
hw <- freqz(b, 512)
plot(f, a, type = "l", xlab = "Radian Frequency (w / pi)",
     ylab = "Magnitude")
lines(hw$w/pi, abs(hw$h), col = "red")
legend("topright", legend = c("Ideal", "Remez"), lty = 1,
       col = c("black", "red"))

gsignal

Signal Processing

v0.3-1
GPL-3
Authors
Geert van Boxtel [aut, cre] (Maintainer), Tom Short [aut] (Author of 'signal' package), Paul Kienzle [aut] (Majority of the original sources), Ben Abbott [ctb], Juan Aguado [ctb], Muthiah Annamalai [ctb], Leonardo Araujo [ctb], William Asquith [ctb], David Bateman [ctb], David Billinghurst [ctb], Juan Pablo Carbajal [ctb], André Carezia [ctb], Vincent Cautaerts [ctb], Eric Chassande-Mottin [ctb], Luca Citi [ctb], Dave Cogdell [ctb], Carlo de Falco [ctb], Carne Draug [ctb], Pascal Dupuis [ctb], John W. Eaton [ctb], R.G.H Eschauzier [ctb], Andrew Fitting [ctb], Alan J. Greenberger [ctb], Mike Gross [ctb], Daniel Gunyan [ctb], Kai Habel [ctb], Kurt Hornik [ctb], Jake Janovetz [ctb], Alexander Klein [ctb], Peter V. Lanspeary [ctb], Bill Lash [ctb], Friedrich Leissh [ctb], Laurent S. Mazet [ctb], Mike Miller [ctb], Petr Mikulik [ctb], Paolo Neis [ctb], Georgios Ouzounis [ctb], Sylvain Pelissier [ctb], Francesco Potortì [ctb], Charles Praplan [ctb], Lukas F. Reichlin [ctb], Tony Richardson [ctb], Asbjorn Sabo [ctb], Thomas Sailer [ctb], Rolf Schirmacher [ctb], Rolf Schirmacher [ctb], Ivan Selesnick [ctb], Julius O. Smith III [ctb], Peter L. Soendergaard [ctb], Quentin Spencer [ctb], Doug Stewart [ctb], P. Sudeepam [ctb], Stefan van der Walt [ctb], Andreas Weber [ctb], P. Sudeepam [ctb], Andreas Weingessel [ctb]
Initial release
2021-05-02

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.