comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Re: bandpass filter
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Re: bandpass filter [message #33672] Sun, 19 January 2003 19:06
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
tom (tom2959@21cn.com) writes:

> Hi,where can I find bandpass filter(for example,Butter-worth) written in
> IDL?

IDL> filename = Filepath(['examples','demo','demosrc'], 'd_filter.pro']
IDL> Print, filename

Look on lines 545-564 of this file. You will find this:

case filtertype of
; Define Butterworth filter types.
;
0: BEGIN
if (bandtype EQ 0) then begin ; Compute lowpass filter.
filter = 1.0d / (1.0d + (distfun / cutoff)^(2 * order))
endif else if (bandtype EQ 1) then begin ; Compute highpass filter.
filter = 1.0d / (1.0d + (cutoff / distfun)^(2 * order))
endif else begin ;Bandpass or bandreject
filter = distfun^2 - cutoff^2 ;Dist squared
zeroes = WHERE(abs(filter) EQ 0.0, count)
if (count NE 0) then filter[zeroes] = 1d-4 ;Avoid divide by 0
filter = 1.0d / (1.0d + $ ; Compute bandreject filter.
((distfun * bandwidth) / filter) ^ (2 * order))

if (bandtype EQ 2) then $ ; Compute bandpass filter.
filter = 1.0 - filter
endelse
end ; of 0

If you want to see this code in operation, type "demo" at the
IDL prompt. Then select "Signal Processing". You can play around
all you like.

Cheers,

David

--
David W. Fanning, Ph.D.
Fanning Software Consulting, Inc.
Phone: 970-221-0438, E-mail: david@dfanning.com
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Toll-Free IDL Book Orders: 1-888-461-0155
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: IDL 5.6, MacOSX, IDLWAVE, Xemacs, and suicide
Next Topic: polar interpolation

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Wed Oct 08 16:50:00 PDT 2025

Total time taken to generate the page: 0.00498 seconds