# How can I filter out a signal while extracting only the desired one?

I know that my input signal contains a main sinusoidal signal, and I know its frequency but not its amplitude.

Until now, I have been successfully using the least-squares method to generate a sinusoidal signal with the least difference from my input.

However, this method breaks down when faced with slightly more complicated input signals, where the noise is big enough to disturb the list square. As a consequence, it's not efficient anymore.

What are some other ways I can accomplish this filtering that don't have the same issue?

• Are you talking about building analog filters into your acquisition system or digitally processing what you've already got? There are a lot of good options for both.
– Dan
Commented Jan 21, 2015 at 5:33
• yes digitally process the obtained signal. I will be glad if you insight me with some options Commented Jan 21, 2015 at 5:36
• What sort of frequencies are you talking about? Hz, kHz, MHz? Commented Jan 21, 2015 at 14:46

First, I would recommend that you create a frequency spectrum of your signal. From your question I interpret that you already know the frequency of your sinusoidal signal.

A common way for the computation of a frequency spectrum is a Fast Fourier Transform. Most software packages have a ready to use algorithm for this implemented.

If you have a look at your frequency spectrum, there are different types of noise, most common are

Know comes the tricky part:

The filtering of noise

Depending on your frequency range, in which you want to acquire a signal, and the noise you record as well, there are three different filter types you can use

Attention: Filtering of the signal after it was converted into a digital signal only makes sense if you can make shure that you do not get trapped with aliasing.

• If you know the frequency do you even need to filter at all? You could just pick the correct components from the FT and they will tell you the amplitude. Commented Jan 21, 2015 at 11:08

It sounds like what you're looking for is a bandpass filter. It will filter out any signal outside of a given frequency range. If the noise isn't too strong, the main signal should come through fairly clearly. The actual design of the bandpass filter is another matter, depending on what frequency range you need and how prevalent the noise is. It may not spit out a perfect sinusoid, but it might get you close enough that you could use your least-squares method on the bandpass output to generate the sinusoid.

(How do you know the signal frequency?) OK this may be over the top for your application, but if you have access to the drive (reference) signal, then you can make a lock-in or synchronous detector.