Prev Next fn2dlp

Converting From A Normalized To Digital Lowpass Filter [O-Matrix function]
Syntax fn2dlp(wc, dt, b_in, a_in, bz, az)
Include: O-Matrix function. No include equired.
See Also fn2dhp , fn2dbp , fn2dbs , fc2dig

    wc: Real or Double scalar specifying desired radian cutoff frequency for the new digital lowpass filter.
    dt: Real or Double scalar, sampling interval, in [seconds]
  b_in: Real or Double column vector, input numerator polynomial of the normalized continuous lowpass
        prototype filter.
  a_in: Real or Double column vector, input denominator polynomial of the normalized continuous lowpass
        prototype filter.
    bz: Real or Double column vector, output numerator   polynomial for the digital lowpass filter.
    az: Real or Double column vector, output denominator polynomial for the digital lowpass filter.


This function converts an input continuous domain rational transfer function (H = b_in/a_in) to its corresponding z-domain digital transfer function. The function is intended to be used with normalized, s-domain, lowpass filter functions as can be obtained from functions such as: fnbut , fncheb1 , fncheb2 , fnbes .

The sampling interval for the new filter is "dt", making the system sampling rate fs = 1/dt. Generally, the new desired cutoff frequency is in [radians/sec], wc = 2*PI*fc, and should be strictly less than half of the sampling rate.

The complex gain for this resulting filter can be evaluated with the gainz function.

The output z-domain polynomial "bz" and "az" must be declared before calling the function, though their types do not matter.


# Design BESSEL lowpass prototype filter, fc = 1 [radian/sec]
Norder  = 5;                  # Filter Order
b       = novalue;            # Declare numerator   polynomial
a       = novalue;            # Declare denominator polynomial
fnbes(Norder,b,a);            # Make analog prototype lowpass filter

# Convert filter to a digital filter
bz = novalue;                 # Declare output numerator   polynomial
az = novalue;                 # Declare output denominator polynomial
fs = 100e3;                   # Sampling Frequency [Samples/sec] = [Hz]
dt = 1d0/fs;                  # Sampling interval [Sec]
fc = 10d3;                    # New lowpass cutoff frequency
wc = 2d0*PI*fc;               # Equivalent radian frequency
fn2dlp(wc, dt, b, a, bz, az); # Convert the filter

# Evaluate this filter around its cutoff.
fmin    =  1d2; # Plotting Limits
fmax    =  fs;
ymax    =  10d0;
ymin    = -100d0;
ny = round((ymax-ymin)/10d0);

N       = 201; # Plotting information         
n       = seq(N)'-1d0;
f       = logspace(log10(fmin),log10(fs/2),N)';
H       = gainz(bz,az,f,fs);
HdB     = db20(H);