PDA

View Full Version : digital_filter



Boscombe
10-19-2007, 10:45 AM
I have some code to remove frequecies from time series data using a band pass filter. Now we are trying to operate the code with vastly changed input frequencies (previously 100-1000Hz, now about 1Hz)

result = digital_filter(flow, fhigh, gibbs, nterm)

In the digital filter routine we use gibbs = 50 and nterm as the frequency (not really sure why that was done).

Obviously as frequency drops below 1Hz, this causes the code to fail.

Does anyone have a definitive value or equation to derive the value I should use for nterm. :confused:

rwagner
10-19-2007, 01:07 PM
Hi!
So from the docs: nterm is the number of terms in the filter formula used. Determines the order of the filter. Since DIGITAL_FILTER is used to create a kernel for CONVOL we should keep in mind that CONVOL only processes the parts of the input array between 1/2 the kernel size and N_ELEMENTS(array) - 1/2 the kernel size. If this presents an issue, you can always concatenate the array to itself to insure the ends are processed.

The frequency works for the value of nterm because any value less than that could mean that some elements of the signal may not be processed. The only thing you would gain by using a higher value would be added processing time, and more data at the ends of the array being left unprocessed.

The result from DIGITAL_FILTER is a kernel for CONVOL of size (2 * nterm) -1 which can unambiguously express a signal of frequency nterm.

Hope this helps!
-Ryan