View source: R/remez.R View source: R/RcppExports.R
remez | R Documentation |
Parks-McClellan optimal FIR filter design using the Remez exchange algorithm.
remez(
n,
f,
a,
w = rep(1, length(f)/2),
ftype = c("bandpass", "differentiator", "hilbert"),
density = 16
)
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 |
w |
vector of weights used to adjust the fit in each frequency band. The
length of |
ftype |
filter type, matched to one of |
density |
determines how accurately the filter will be constructed. The minimum value is 16 (default), but higher numbers are slower to compute. |
The FIR filter coefficients, a vector of length n + 1
, of
class Ma
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.
https://en.wikipedia.org/wiki/Fir_filter
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
Ma
, filter
, fftfilt
,
fir1
## 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"))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.