# Frequency Filtration

I have a signal that consists of N frequencies all with unknown phase and frequency(N) = frequency(N-1) + 2Hz. I would like to selectively scale the amplitudes of some of those signals in such a way that I can change which frequencies to scale and how much to scale them on the fly.

Is this possible? How complex of a circuit would this be?

Analog? Digital? or Both?

Where should I start?

Thanks

• how big is N? ... – markrages Nov 30 '10 at 16:22
• Arbitrarily Large. Between One Hundred Thousand and One Million. – Ned Bingham Nov 30 '10 at 16:26
• This is going to be very very very hard and yes you will need a digital filter. – Kortuk Nov 30 '10 at 16:29
• Do you need it to filter in real time? This makes a difference with processing power. – Kellenjb Nov 30 '10 at 16:45
• Yeah... Real time. However, I don't necessarily need the output signal to look like the input signal. The input signal is an impulse where each frequency only goes through half a period, but the integral of the wave function of each frequency is the same. All I need to get out at the end is a summation of sorts where I can chose which frequencies affect the final sum and by how much. – Ned Bingham Nov 30 '10 at 16:58

To expand on Brian, making a filter with analog components that has a very small passband with a fast transition into the stop band is nearly impossible, while this is very very easy with a digital system.

You will have to sample at-least twice as fast as the fastest signal. I would suggest making sure you are at-least 2.1 times faster.

For will need to design one gigantic filter that changes each frequency by the amount you want.

If you want to control the magnitude of each signal separately then you will have to make N digital filters, create N datasets, apply the N different gains, and then recombine the signals, if you filtering is good you will just be able to sum to recombine. Do not take too much solace in this as it is the only easy step.

The sharper you want your transitions the more data-points the filter will need. There is no way around this, it has been proven mathematically.

Let me know in a comment if I can add more to help.

• So basically, it cant be done without a gigantic filter... That answers my question pretty well. Would it change the answer if the phase was known for all N frequencies? – Ned Bingham Nov 30 '10 at 16:48
• no, the phase makes little difference. – Kortuk Nov 30 '10 at 16:50
• The FFT can be considered a bank of N filters (where N is a power of 2.) So don't recreate the wheel. Allowing N to be a power of 2 simplifies the number of multiplies necessary. – markrages Nov 30 '10 at 16:57
• yes, i understand your approach, i was explaining for retaining phase. if you just fft a signal where you need to find 100000 different frequencies, scale them separately, and then recreate the signal, especially if they vary in time, you need as much ram and still have a ton of work. – Kortuk Nov 30 '10 at 17:03

For that many passbands, you can take your signal, chunk it into windows, then FFT the window. (You will need a huge window for a million bins.) Then scale the magnitude of each frequency bin as desired, then do the inverse FFT, then reassemble the chunks into a continuous stream.

This will scramble phase a little bit, but it works well enough in many applications.

• you will need a huge number of points in the fft for that many frequencies or need to implement a wavelet technique. – Kortuk Nov 30 '10 at 16:52
• True. ... ... ... – markrages Nov 30 '10 at 16:59
• this also is very challenging if the sigals change with time. hell, it is alot of work if they do not. – Kortuk Nov 30 '10 at 17:05
• Yes, FFT is the way to go. To get exactly 2 Hz wide frequency bins, you'll need to pass a window of data exactly 0.5 seconds long to the FFT. – davidcary Feb 18 '11 at 4:32

It would need to be digital for any good number of N. Start with a basic digital filter book.

You will probably need to use digital signal processing.
Check out http://www.dspguide.com/ for a primer on DSP.