|See Also||fn2clp , fn2chp , fn2cbp|
usage: include function\fn2cbs.oms
wc: A two element Real or Double row vector specifying the lower and upper radian
cutoff frequencies [rad/sec] for the new bandstop filter, such that:
wc(1) is the lower frequency limit for bandstop filter, and
wc(2) is the upper frequency limit for bandstop filter.
b_in: Column Vector, Input , specifying the numerator polynomial for the normalized filter.
a_in: Column Vector, Input , specifying the denominator polynomial for the normalized filter.
b: Column Vector, Output, returning the numerator polynomial for the bandstop filter.
a: Column Vector, Output, returning the denominator polynomial for the bandstop filter.
This function takes the numerator and denominator polynomials of a lowpass normalized continuous transfer function (Hin = b_in/a_in), converts and frequency translates them to the desired lower and upper radian cutoff frequencies [rad/sec] given in the two element vector "wc" (Hout = b/a) of a new bandstop filter. Sources of normalized filter transfer functions can be obtained from functions such as fn2chp , fn2cbp , fn2cbs , or, any similar user defined function. The first element of "wc" is the lower cutoff frequency and the second element is the upper.
The input and output polynomials are ascending polynomials in s = jw expressed as a column vector of length n as:
The output polynomials b and a must be declared before the function is called, though their types do not matter. They can be declared as type "b = novalue", "a = novalue", for instance.
b => b(1) + n(2) * s + .. + b(n) * s^(n-1); similarly for a.
A plot of the resulting filter appears as:
# Design BESSEL lowpass prototype filter, fc = 1 [radian/sec]
Norder = 6;
b_in = novalue;
a_in = novalue;
fnbes(Norder, b_in, a_in);
# Convert filter to a new bandstop cutoff frequency
b = novalue; # Declare output numerator polynomial
a = novalue; # Declare output denominator polynomial
flow = 600d0; # New lower cutoff frequency
fhigh = 3000d0; # New upper cutoff frequency
wc = 2d0*PI*[flow,fhigh]; # Equivalent radian frequency
fn2cbs(wc, b_in, a_in, b, a); # Convert the filter
# Evaluate this filter around its cutoff.
fmin = 1d2; # Plotting Limits
fmax = 1d4;
ymax = 10d0;
ymin = -60d0;
N = 501; # Plotting information
n = seq(N)'-1d0;
f = logspace(log10(fmin),log10(fmax),N)';
H = gains(b,a,f);
HdB = db20(H);