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?


  • \$\begingroup\$ how big is N? ... \$\endgroup\$ – markrages Nov 30 '10 at 16:22
  • \$\begingroup\$ Arbitrarily Large. Between One Hundred Thousand and One Million. \$\endgroup\$ – Ned Bingham Nov 30 '10 at 16:26
  • 3
    \$\begingroup\$ This is going to be very very very hard and yes you will need a digital filter. \$\endgroup\$ – Kortuk Nov 30 '10 at 16:29
  • 2
    \$\begingroup\$ Do you need it to filter in real time? This makes a difference with processing power. \$\endgroup\$ – Kellenjb Nov 30 '10 at 16:45
  • \$\begingroup\$ 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. \$\endgroup\$ – 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.

  • \$\begingroup\$ 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? \$\endgroup\$ – Ned Bingham Nov 30 '10 at 16:48
  • \$\begingroup\$ no, the phase makes little difference. \$\endgroup\$ – Kortuk Nov 30 '10 at 16:50
  • 1
    \$\begingroup\$ 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. \$\endgroup\$ – markrages Nov 30 '10 at 16:57
  • \$\begingroup\$ 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. \$\endgroup\$ – 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.

  • \$\begingroup\$ you will need a huge number of points in the fft for that many frequencies or need to implement a wavelet technique. \$\endgroup\$ – Kortuk Nov 30 '10 at 16:52
  • \$\begingroup\$ True. ... ... ... \$\endgroup\$ – markrages Nov 30 '10 at 16:59
  • \$\begingroup\$ this also is very challenging if the sigals change with time. hell, it is alot of work if they do not. \$\endgroup\$ – Kortuk Nov 30 '10 at 17:05
  • \$\begingroup\$ 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. \$\endgroup\$ – 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.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.