Google

section f of routines in filter.i

yorick banner

Home

Manual

Packages

Global Index

Keywords

Quick Reference

functions in filter.i - f

 
 
 
fft_good


             fft_good(n)  
 
     returns the smallest number of the form 2^x*3^y*5^z greater  
     than or equal to n.  An fft of this length will be much faster  
     than a number with larger prime factors; the speed difference  
     can be an order of magnitude or more.  
     For n>100, the worst cases result in a little over a 11% increase  
     in n; for n>1000, the worst are a bit over 6%; still larger n are  
     better yet.  The median increase for n<=10000 is about 1.5%.  
SEE ALSO: fft,   fft_setup,   convol  
 
 
 
fil_analyze


             fil_analyze, filt, poles, zeroes  
 
     given a FILT, return the complex POLES and ZEROES, sorted in  
     order of increasing imaginary part.  The real parts of POLES will  
     all be negative if the FILT is stable.  

interpreted function, defined at i/filter.i   line 160  
SEE ALSO: filter,   fil_make  
 
 
 
fil_bessel


             filt= fil_bessel(np, wc, db)  
 
     returns the lowpass Bessel filter with NP poles, normalized  
     such that at angular frequency WC, the attenuation is DB decibels.  
     (That is, the attenuation factor is 10^(.05*DB) at WC,  
      so that to_db(response(filt,WC))==DB.)  
     A Bessel filter has the most nearly constant group delay time  
     d(phase)/dw of any filter of the same order.  It minimizes pulse  
     distortion, but does not cut off very rapidly in frequency.  
     If WC is nil or zero, it defaults to 1.0.  
     If DB is nil, the filter is normalized such that both the s^0  
     and s^NP terms are 1, unless the natural= keyword is non-zero,  
     in which case the filter is normalized such that the group delay  
     d(phase)/dw is -1 at w=0.  

interpreted function, defined at i/filter.i   line 178  
SEE ALSO: filter,   fil_analyze  
 
 
 
fil_butter


             filt= fil_butter(np, wc, db)  
 
     returns the lowpass Butterworth filter with NP poles, normalized  
     such that at angular frequency WC, the attenuation is DB decibels.  
     (That is, the attenuation factor is 10^(.05*DB) at WC,  
      so that to_db(response(filt,WC))==DB.)  
     A Butterworth filter is the best Taylor series approximation to  
     the ideal lowpass filter (a step in frequency) response at both  
     w=0 and w=infinity.  
     For wc=1 and db=10*log10(2), the square of the Butterworth frequency  
     response is 1/(1+w^(2*np)).  
     If WC is nil or zero, it defaults to 1.0.  
     If DB is nil, the filter is normalized "naturally", which is the  
     same as DB=10*log10(2).  

interpreted function, defined at i/filter.i   line 226  
SEE ALSO: filter,   fil_analyze,   butter  
 
 
 
fil_cauer


             filt= fil_cauer(np, ripple, atten, wc, db)  
          or filt= fil_cauer(np, ripple, -skirt, wc, db)  
 
     returns the lowpass Cauer (elliptic) filter with NP poles, passband  
     ripple RIPPLE and stopband attenuation ATTEN decibels, normalized  
     such that at angular frequency WC, the attenuation is DB decibels.  
     (That is, the attenuation factor is 10^(.05*DB) at WC,  
      so that to_db(response(filter,WC))==DB.)  
     If the third parameter is negative, its absolute value is SKIRT,  
     the ratio of the frequency at which the stopband attenuation is  
     first reached to the frequency at which the passband ends (where  
     the attenuation is RIPPLE).  The closer to 1.0 SKIRT is, the  
     smaller the equivalent ATTEN would be.  The external variable  
     cauer_other is set to ATTEN if you provide SKIRT, and to SKIRT  
     if you provide ATTEN.  
     The Cauer filter has NP zeroes as well as NP poles.  
     Consider the four parameters: (1) filter order, (2) transition  
     ("skirt") bandwidth, (3) passband ripple, and (4) stopband ripple.  
     Given any three of these, the Cauer filter minimizes the fourth.  
     If WC is nil or zero, it defaults to 1.0.  
     If DB is nil, the filter is normalized "naturally", which is the  
     same as DB=RIPPLE.  

interpreted function, defined at i/filter.i   line 357  
SEE ALSO: filter,   fil_analyze,   cauer  
 
 
 
fil_cheby1


             filt= fil_cheby1(np, ripple, wc, db)  
 
     returns the lowpass Chebyshev type I filter with NP poles, and  
     passband ripple RIPPLE decibels, normalized such that at  
     angular frequency WC, the attenuation is DB decibels.  
     (That is, the attenuation factor is 10^(.05*DB) at WC,  
      so that to_db(response(filter,WC))==DB.)  
     A Chebyshev type I filter gives the smallest maximum error over the  
     passband for any filter that is a Taylor series approximation to  
     the ideal lowpass filter (a step in frequency) response at  
     w=infinity.  It has NP/2 ripples of amplitude RIPPLE in its passband,  
     and a smooth stopband.  
     For wc=1 and db=ripple, the square of the Chebyshev frequency  
     response is 1/(1+eps2*Tnp(w)), where eps2 = 10^(ripple/10)-1,  
     and Tnp is the np-th Chebyshev polynomial, cosh(np*acosh(x)) or  
     cos(np*acos(x)).  
     If WC is nil or zero, it defaults to 1.0.  
     If DB is nil, the filter is normalized "naturally", which is the  
     same as DB=RIPPLE.  

interpreted function, defined at i/filter.i   line 263  
SEE ALSO: filter,   fil_analyze,   cheby1  
 
 
 
fil_cheby2


             filt= fil_cheby2(np, atten, wc, db)  
 
     returns the lowpass Chebyshev type II filter with NP poles, and  
     stopband attenuation ATTEN decibels, normalized such that at  
     angular frequency WC, the attenuation is DB decibels.  
     (That is, the attenuation factor is 10^(.05*DB) at WC,  
      so that to_db(response(filter,WC))==DB.)  
     This is also called an inverse Chebyshev filter, since its poles  
     are the reciprocals of a Chebyshev type I filter.  It has NP zeroes  
     as well as NP poles.  
     A Chebyshev type II filter gives the smallest maximum leakage over  
     the stopband for any filter that is a Taylor series approximation to  
     the ideal lowpass filter (a step in frequency) response at  
     w=0.  It has NP/2 ripples of amplitude ATTEN in its stopband,  
     and a smooth passband.  
     For wc=1 and db=ripple, the square of the inverse Chebyshev frequency  
     response is 1 - 1/(1+eps2*Tnp(1/w)), where eps2 = 10^(ripple/10)-1 =  
     1/(10^(atten/10)-1) and Tnp is the np-th Chebyshev polynomial,  
     cosh(np*acosh(x)) or cos(np*acos(x)).  
     If WC is nil or zero, it defaults to 1.0.  
     If DB is nil, the filter is normalized "naturally", which is the  
     same as DB=ATTEN.  

interpreted function, defined at i/filter.i   line 305  
SEE ALSO: filter,   fil_analyze,   cheby2  
 
 
 
fil_delay


             fil_delay(filt)  
          or fil_delay(filt, 1)  
 
     return the group delay d(phase)/dw at w=0 (zero frequency) for  
     filter FILT.  By default, FILT is assumed to be normalized   
     to an angular frequency (e.g.- radians per second), but if  
     the 2nd parameter is non-nil and non-0 FILT is assumed to be  
     normalized to a circular frequency (e.g.- Hz or GHz).  

interpreted function, defined at i/filter.i   line 93  
SEE ALSO: filter,   fil_butter,   fil_bessel,   fil_cheby1,  
fil_cheby2,   fil_response,   to_db,   to_phase  
 
 
 
fil_make


             filt= fil_make(poles, zeroes)  
 
     given the complex POLES and ZEROES, return a FILT.  The real  
     parts of POLES must all be negative to make a stable FILT.  
     Both POLES and ZEROES must occur in conjugate pairs in order to  
     make a real filter (the returned filter is always real).  
     The returned filter always has a0=1 (its DC gain is 1).  

interpreted function, defined at i/filter.i   line 126  
SEE ALSO: filter,   fil_analyze  
 
 
 
fil_normalize


 fil_normalize  
 
  

interpreted function, defined at i/filter.i   line 473  
 
 
 
fil_poly


             fil_poly(c, x)  
 
     return c(1) + c(2)*x + c(3)*x^2 + c(4)*x^3 + ...  

interpreted function, defined at i/filter.i   line 115  
 
 
 
fil_response


             fil_response(filt, w)  
 
     return the complex response of FILT at the frequencies W.  
     The frequency scale for W depends on how FILT has been scaled;  
     filters are rational functions in W.  
     The to_db and to_phase functions may be useful for extracting  
     the attenuation and phase parts of the complex response.  

interpreted function, defined at i/filter.i   line 72  
SEE ALSO: filter,   fil_butter,   fil_bessel,   fil_cheby1,  
fil_cheby2,   fil_delay,   to_db,   to_phase  
 
 
 
filter


             filter(filt, dt, signal)  
 
     apply the filter FILT to the input SIGNAL, which is sampled  
     at times spaced by DT.  The filter is assumed to be normalized  
     to an angular frequency (e.g.- radians per second), unless  
     DT<0, in which case FILT is assumed to be normalized to a  
     circular frequency (e.g.- Hz or GHz).  
     The result will have the same length as SIGNAL; be sure to pad  
     SIGNAL if you need the response to go beyond that time, or  
     you can use the pad=n keyword to force the returned result to  
     have N samples more than SIGNAL.  
     If the shift= keyword is non-nil and non-0, then the result  
     is shifted backward in time by the filter group delay at  
     zero frequency.  
     The impulse response of the FILT is also assumed to be shorter  
     than the duration of signal, and SIGNAL is assumed to be sampled  
     finely enough to resolve the FILT impulse response.  
     FILT is an array of double, which represents a filter with  
     a particular finite list of zeroes and poles.  See the specific  
     functions to construct filters from poles and zeroes (fil_make),  
     or classic Bessel, Butterworth, Chebyshev, inverse Chebyshev, or  
     Cauer (elliptic) designs.  With fil_analyze, you can find the  
     poles and zeroes of a FILT.  The format for FILT is:  
     FILT is an array of double with the following meanings:  
       FILT(1) = np = number of poles  (integer >= 0)  
       FILT(2) = nz = number of zeroes (integer >= 0)  
       FILT(3) = reserved  
       FILT(4:4+nz) = coefficients for numerator  
                 = [a0, a1, a2, a3, ..., anz]  
       FILT(5+nz:4+nz+np) = coefficents for denominator (if np>0)  
                 = [b1, b2, b3, ..., bnp]  
     The Laplace transform (s-transform) of the filter response is  
       L[FILT] = (a0 + a1*s + a2*s^2 + a3*s^3 + ...) /  
                 ( 1 + b1*s + b2*s^2 + b3*s^3 + ...)  

interpreted function, defined at i/filter.i   line 8  
SEE ALSO: filter,   fil_bessel,   fil_butter,   fil_cheby1,  
fil_cheby2,   fil_cauer,   fil_response,   fil_make,  
fil_analyze,   to_db,   to_phase