I was trying to think about how to do time-domain analysis of a real-valued signal to determine if it contains a particular carrier. I can obviously just compute an FFT, but that transforms a window of samples into the frequency domain. I don't necessarily need a measurement of the entire frequency domain, just to determine if it contains a particular frequency.
I generated a signal at a sample rate of 8000 samples per second, a carrier of 444 Hz, and some uniform noise. The carrier amplitude is 0.7 and the noise amplitude is 0.3, for a range of
To analyze the signal I generated a filter that has a buffer of samples and a buffer of expected values. The expected values are populated with a sine wave from
[0, 2*pi]. When a new sample comes in, the oldest is pushed out of the filter. The filter's measurement is obtained by computing the product of each sample with the expected value, summing it and diving by half the filter length.
This gave really poor results, but I had the idea that the filters was just responding too quickly. I increased the expected values from
[0, 8*pi] and increased the samples buffer accordingly. This seemed to reproduce the expected signal and rejects other signals. So I took the output of this filter and put that into a moving average. The moving average is computed with a window of samples that is large enough to hold
[0,4*pi]. The sum of squares of the samples is divided by the filter length to get the measurement of that filter. This rises to a value of above 0 when the filter chain is input with a signal of the freq. it is trying to test for.
A graph of this output is shown here
All the filters are initialized to zero values at first, so it rises after a few periods and levels off. I also tested the 2nd harmonic of my signal to make sure there it was not a fluke
The filter passes a small amplitude but the average stays right around 0. So it seems this method is reasonably effective. Computationally I guess it is pretty expensive.
I do see an issue if the input signal is not approximately in the amplitude of
I don't know much about DSP but is there a terminology for this kind of filter?