# NOT RUN {
## compare the frequency responses of 5th-order Butterworth
## and elliptic filters.
bf <- butter(5, 0.1)
ef <- ellip(5, 3, 40, 0.1)
bfr <- freqz(bf)
efr <- freqz(ef)
plot(bfr$w, 20 * log10(abs(bfr$h)), type = "l", ylim = c(-80, 0),
xlab = "Frequency (Rad)", ylab = c("dB"), lwd = 2,
main = paste("Elliptic versus Butterworth filter",
"low-pass -3 dB cutoff at 0.1 rad", sep = "\n"))
lines(efr$w, 20 * log10(abs(efr$h)), col = "red", lwd = 2)
legend ("topright", legend = c("Butterworh", "Elliptic"),
lty = 1, lwd = 2, col = 1:2)
# }
Run the code above in your browser using DataLab