0
$\begingroup$

I have a continuous signal. I digitize it at 40kHz. A useful signal for me is in the range of 500-1500Hz and takes ~ 50-100Hz. It can be located in any part of this strip at any time. enter image description here If I apply a digital bandpass filter at 500-1500Hz, I will select the signal I want from the entire band, and along the way I will collect all the noise in the 500-1500Hz band. To reduce noise, I divided this band into 10 bands of 100 Hz (also with digital bandpass filters) and from them I choose the one with the largest signal. At the same time, I do not collect noise across all bands, that is, I have improved the signal-to-noise ratio. enter image description here But there are moments when the signal is on the border of my 10 filters, that is, part of it falls on one filter, part on another, and I lose signal-to-noise ratio. enter image description here An obvious option for me is to split the 500-1500Hz band into more bands, but the computational capabilities of my microcontroller are limited, and I cannot afford to increase the number of filters anymore.

Is there any good way to select a signal located in the 500-1500Hz band without collecting noise from the entire frequency band? I also wonder if there are 2 such signals in my 500-1500Hz frequency band, how can I do in this situation? And will it be possible to unite them? Perhaps the Wavelet transformation will help me, but in the Internet I did not find any information on how it can be implemented on a microcontroller.

$\endgroup$
  • $\begingroup$ Is your signal generally a sinusoid? What is the end goal, what are you actually wanting to measure? $\endgroup$ – Cedron Dawg Sep 4 at 13:35
  • $\begingroup$ @Cedron Dawg The ultimate goal is to get the amplitude of this signal with the best signal-to-noise ratio $\endgroup$ – red15530 Sep 4 at 13:44
  • $\begingroup$ If you can characterize your signal as a pure tone for a short duration, the best solution I know of is this: dsprelated.com/showarticle/1284.php I recommend a frame of 2 1/2 cycles. You have at least 20 samples per cycle which is more than plenty for good noise reduction. Having two tones requires a little more processing, amount depending on their closeness. $\endgroup$ – Cedron Dawg Sep 4 at 13:53
  • $\begingroup$ You could decimate the signal to reduce the computational load on the micro. Atm you're sampling rate is roughly 20 times higher than your highest frequency(but this depends on the application and accuracy required). Have you considered the Goertzel algorithm which could further educe your computational load. en.wikipedia.org/wiki/Goertzel_algorithm $\endgroup$ – zoulzubazz Sep 4 at 14:17
  • $\begingroup$ @Cedron Dawg I have several such windows with signals, these are 500-1500Hz, 1500-2500Hz, 2500-3500Hz, etc. My real signal is a triangle, that is, it has a center frequency and several harmonics and plus a noise component. The algorithm that you suggested to me is not clear to me ... Could you explain in more detail? $\endgroup$ – red15530 Sep 4 at 16:46
0
$\begingroup$

The algorithm I referenced is premised on the signal being a pure real tone, in which case it will give an exact answer.

The presence of noise or other tones will distort the answer somewhat, but the formulas are actually quite robust. As long as the tones are fairly far apart (at least several bins), the distortion due to other tones is small.

Aligning your DFT frame so the main tone is roughly a whole number of cycles and a half has two advantages.

  1. The parameters are read from four values of the DFT instead of two, so inherently more noise resistant.

  2. The second harmonic will fall near a whole number of cycles and thus not have much leakage.

If necessary, your signal can be filtered (as you have done) to reduce the magnitude of the harmonics, but you need to know the frequency response of the filter to adjust your amplitude calculation.

Real world signals tend not to be pure tones. The smaller the segment, the more it will resemble a pure tone. The formulas I referenced (and am the discoverer of) have the advantage of being exact, so a large N is not necessary for better results. In a recent job, I was able to take 8 point DFTs on ~1 1/2 cycle frames to calculate the frequency, phase, and amplitude to about 4-5 significant figures.

In radar jobs in the past, and the non-radar one just mentioned, the variation in the signal meant the results you get are dependent on your frame selection and how you choose to average your results. The algorithm can give you nearly instantaneous values along your signal duration.

The derivation of the frequency formula can be found here:

This is an extension to three bins, which can be used if your peak is near a bin (< 0.15 bin width) for more noise robust results.

In the pure noiseless single tone case, either formula will yield an exact answer.

| improve this answer | |
$\endgroup$
  • $\begingroup$ Thank you very much for such a detailed answer! I will definitely study all this information, but it is hard for me. Perhaps, if I understand better, if you can help me figure it out with a specific example. As I said earlier, I digitize a signal with a frequency of 40 kHz, then I pass this signal through a digital bandpass filter of 500-1500 Hz. How can I then apply your formulas to separate the signal amplitude from the noise in my bandwidth? $\endgroup$ – red15530 Sep 4 at 18:38
  • $\begingroup$ @red15530 How noisy? Do you have any idea of the SNR? Generally speaking, the more sample points you use, the less impact noise has, e.g. you are "averaging it out". Filtering should improve results in terms of minimizing other tones (including the harmonics). With heavy smoothing, you can also "decimate" your signal for a longer duration read with fewer points. The best approach is really data dependent and you haven't really provided a sufficient description for me to make a call. The ideal number of sample points per cycle is 4, that is the "sweet spot" at half Nyquist. $\endgroup$ – Cedron Dawg Sep 4 at 18:50
  • $\begingroup$ If you align your DFT frame on a whole number of cycles, then you can read the amplitude straight from the magnitude of the respective bin (and that is the only bin you need to calculate, hence the Goertzel recommendation by @zoulzubazz). The two bin approach on a whole number of cycles plus a half will be more robust and accurate, but it requires the calculation of two bins. If you could show a stretch of your signal using about a 100 samples that would be helpful. $\endgroup$ – Cedron Dawg Sep 4 at 18:57
  • $\begingroup$ I will be able to provide a recording of the real signal only on Monday, when I get to the right equipment. My signal has a triangular shape, lies in the 500-1500Hz band with a constantly changing frequency. I am not familiar with the Gambas language. I am trying to reproduce your example in Matlab. $\endgroup$ – red15530 Sep 4 at 19:19
  • $\begingroup$ @red15530 Gambas is very much like VisualBasic6. You might find it easier to code from the formulas in the derivation article. I don't use Matlab so I don't have any code for that. For repeated triangles, you will likely want to filter it heavily to make them sinusoidal. If that is the only informational component, perhaps a time domain approach might be superior. The advantage of a DFT is that it separates tones. If there are no other tones (aside from harmonics), it might not be the best tool. Localized interpolation may give you better amplitude readings. $\endgroup$ – Cedron Dawg Sep 4 at 19:33

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.