NFILTER.OMS
Script File:
# Description:
# Compares normalized Tchebycheff and Butterworth filters.
#
#
clear
# number of poles in the filters
np = 3
# ripple parameter in Tchebycheff filter
ripple = .8
# normalized Tchebycheff filter
num_c = novalue
den_c = novalue
fncheb(np, ripple, num_c, den_c)
# Butterworth filter
num_b = novalue
den_b = novalue
fnbut(np, num_b, den_b)
# grid on [1 / e^2 , e^2] evenly spaced in log
w = exp(seq(80) / 20. - 2)
#
title = { ...
"Butterworth and Tchebycheff", ...
"3 pole normalized filters" ...
}
gaddtext(title, [.5, 1.], [.5, 1.])
gspace(.1, .1, .1, .2)
gxaxis("log")
gyaxis("log", 1e-5, 100.)
#
# response of Butterworth filter
num_w = polval(num_b, 1i0 * w)
den_w = polval(den_b, 1i0 * w)
res_b = abs(num_w / den_w)^2
#
# response of Tchebycheff filter
num_w = polval(num_c, 1i0 * w)
den_w = polval(den_c, 1i0 * w)
res_c = abs(num_w / den_w)^2
#
# plot responses
gplot(w, [res_b, res_c])
Output:
|