# Ideal Low-Pass Filter Output?

I'm very new to digital signal processing, I've been reading a text book to try to figure out this assignment at work (avionics related). I'm supposed to implement a two-pole low-pass filter with a fixed cutoff frequency (of 0.02Hz)

I'm not sure if my current output is correct, given my understanding of how low pass filters are supposed to work.

The top is my input signal. 3Hz to the left, 1Hz to the right.

Given my current level of understanding of digital signal processing, my expected output of a low-pass filter with a frequency cutoff of 2Hz is in the middle. 0 to the left, and the original 1Hz signal on the right.

The bottom is the output of my current implementation. I don't know if my current implementation is wrong, my understanding, or my expectations of how close to ideal the filters actually are.

This actual implementation is a single pole recursive filter, just trying to get a working example (and understanding) I can test against, before I design everything the way they want it.

The sample rate is 100Hz, so for f = 2Hz, I tried poles of both x = e^(-2*pi*2/100) and x = e^(-2*pi*2/200) (the formula I saw wanted a value from 0 to .5, so assumed it was some fraction of sample rate?)

Any ideas?

-

## migrated from stackoverflow.comNov 25 '12 at 17:15

This question came from our site for professional and enthusiast programmers.

Thanks, I didn't know that was a thing, I'll try there too. –  Chad Mourning Nov 25 '12 at 15:19

From the description I'll take you have a filter with 3 coefficients. (and the formulae are missing the symbol i). With a sample rate of 100 Hz you would require a filter of length 33 to make it cover the complete wave form of one cycle of 3 Hz signal. Just looking one tenth of a waveform a filter would have to do magic to attenuate (just) a 3Hz signal but leave 1Hz signals intact.

If you'll have octave or matlab, you might want to see the frequency response of your filter:

 a=exp(i*pi*2/100);freqz([1,a*conj(a)],1)


Here the 3dB cutoff is approximately at Fs/4 (one quarter of the sampling frequenzy).

-
So how does one get a steeper frequency response then? I know enough about FFTs to convert my signal to frequency domain first if that helps. –  Chad Mourning Nov 25 '12 at 21:15
One goes to more controlled and steeper frequency response by adding the filter length. Three practical methods are '1. window method', which chooses between known filter shapes (=impulse response) with filter length depending on the wanted attenuation -- 2. IFFT method, which inverse transforms the wanted frequency response to (symmetric) FIR filter and 3. Remez algorithm (perhaps the easiest method where in Matlab one describes the shape of transition band) –  Aki Suihkonen Nov 26 '12 at 5:47
I tried the windowed-sinc method, and it worked like a charm. I guess I was over anticipating the performance of the recursive filters. Thanks! –  Chad Mourning Nov 27 '12 at 5:54