Andrew Que Sites list Photos
Projects Contact
Main
    This evening marks the first in what we hope to make a regular meeting for coffee.  Pictured is April.

1 comment has been made.

From April

The Garage

January 18, 2008 at 10:52 PM

I love it , it's shexy!
    My sleepy Vinny cat atop her stool so that she might observe the world

1 comment has been made.

From Ericasaurus Rex

Earth

January 22, 2008 at 6:04 PM

Ooh! I love cats! I want one of my own, but I'm not sure what I wanna name it yet if I get one.

January 14, 2008

Band-pass filtering using a Fast Fourier Transform

   I decided to play around with Fast Fourier Transforms (FFT) a bit and give a little demonstration of band-pass filtering.  The following is a Javascript/PHP demonstration of this.
   The top graph shows the filtered (red) and unfiltered (green) single.  The bottom graph is the unfiltered single in the frequency domain.  The single is made of 3 sine waves.  The frequency and amplitude of these waves can be adjusted by the frequency/amplitude sliders.  Noise is also added onto the single and controlled by the Noise amplitude and Scatter coefficient sliders.  The result of these settings is the unfiltered single.  The high and low cut-off values are the frequencies in which the filter does the band-pass.
   By default, the three frequencies are 8, 16 and 24 Hz.  These frequencies, along with some noise, make up the signal.  The band-pass filter is setup to allow only frequencies between 14 and 18 Hz, meaning only the 16 Hz signal should remain after the filter.  The amplitude of the 16 Hz single is 1.0, and after filtering, the peaks of the red graph should be between -1 and 1.  On the bottom graph, there should be three spikes.  The first one represents the 8 Hz sine-wave, which should rise to 0.8 for amplitude.  The second is for the 16 Hz sine-wave and should rise to 1.0.  The third, 24 Hz and rising to 0.5.  The small ripples on the spectrum graph represents the frequencies introduced by noise.
Not support tag.
   For this project, I had to import a few items.  I translated into PHP an FFT algorithm written in C by Robert Sedgewick and Kevin Wayne.  This algorithm required a complex number class, which I also translated from Java into PHP.  There was no author credited in the original code.
    The FFT is recursive radix-2 algorithm. The implementation is clean, but not very fast. My original experiments were done on 1024 points of data, which I scaled back to 512 for this demo. The next power, 2048, was quite slow, and 4096 hardly worth using.
    The filter is a wall filter--simply stripping off frequencies that are outside the band. Normally there would be some kind of tapered window around the band, but I didn't bother with it for this experiment. In the future, I might cleanup the FFT code in case (for whatever reason) someone wants an FFT function written in PHP. For now, here is the source code for the FFT algorithm and the complex number class it requires.
Katie P.

Katie P.

    Banned a server called "crawl-13.cuill.com" (38.99.44.104) for continuously requesting "robots.txt" about every 2 seconds.  Not sure what that was all about, but whatever the reason they keep requesting it, they're not getting it anymore-- several hundred copies is plenty.