Path: utzoo!utgpu!attcan!uunet!ncrlnk!ncrcae!hubcap!gatech!rutgers!deimos!ksuvax1!cseg!hcx!gmg From: gmg@hcx.uucp (Greg M. Garner) Newsgroups: sci.electronics Subject: Re: Variable bandwidth 6 pole Butterworth LPF Summary: Bilinear transformation Keywords: variable bandwidth,10KHz-1MHz Message-ID: <1136@cseg.uucp> Date: 10 Nov 88 07:42:46 GMT References: <787@mplvax.nosc.MIL> Sender: netnews@cseg.uucp Organization: College of Engineering, University of Arkansas, Fayetteville Lines: 96 In article <787@mplvax.nosc.MIL>, david@mplvax.nosc.MIL (David Almagor) writes: > > I need to design a variable bandwidth low pass filter, whose > programmed pass band will span 10kHz to 1MHz. The field is > open for analog, digital, or any other form of implementation. > The input's dynamic range is about 40dB, and the filter should > have the properties of a 6 pole Butterworth. Budget should > be kept at a min. Any ideas out there? How about using a digital filter. You can take the s equation of a analog 6 pole butterworth filter, and then transform it to digital form by replacing all the s factors with this: s= 2 * [1-Z^(-1)] ------------- T * [1+Z^(-1)] T is usually set to 1, as it cancels out later in the calculations. The steps for doing this transformation are fairly clearly presented in the book "Fundamentals of Digital Signal Processing" by Lonni C. Ludeman. The book is published by Harper & Row, Publishers, Inc. (c) 1986. They describe in chapter 3 how to design analog butterworth filters, and then in chapter 4 they go into how to use the bilinear transform to change the s equations into Z equations. The Z equations are simply delay elements, so if you have a Z^(-1) it is a sample that is one time unit old, and Z^(-2) is two time units old. They show in the book how to design the digital filters when you have a known cutoff frequency, but I messed around a bit with their equations to come up with with a form that had a variable cutoff. The math involved got pretty harry for a simple first order lowpass filter, but I ended up with a lowpass digital filter that I could run a picture through, and then I could adjust the cutoff value and see what the effect was. Here is the portion of C code that did the actual filter, note that I passed the cutoff frequency to this subroutine as a double. The value passed in f represents the digital cutoff frequency in radians, I think. redraw(fp,f) FILE *fp; double f; { double ran(); double y,y1,x,x1; long j,k; int cc; for (j=1; j<=128; j++) { x1=0; y1=0; for (k=1; k<=128; k++) { fscanf(fp,"%d",&cc); /* Read in picture data here. */ x=cc; /* Here is the actual butterworth lowpass filter. */ /* Note how it uses memory and the current input value. */ y=(f*x+f*x1+(2-f)*y1)/(2+f); y1=y; x1=x; /* Save the current values of x and y for the */ cc=y; /* Memory so they will contribute to filter next time. */ if (cc>255) cc=255; if (cc<0) cc=0; cc=cc/16+16; /* My machine only has 16 gray levels (Amiga). */ SetAPen(rp,cc); WritePixel(rp,k,j); } } } It took me some time to wade through all this, but it is possible. the only problem may be that you need to run this filter in realtime, and you are going to have trouble finding something that will execute the floating point multiplies and divides fast enough to keep up. maybe a floating point DSP chip could do it. Note that the math to implement the 6th order butterworth will probably take you about 1 day to get all worked out, so send me the results if you do it! > > Thanks in advance, David. > Your Welcome! Greg Garner gmg@hcx.uucp path: ...!uunet!harris.cis.ksu.edu!hcx!gmg 501-442-4847