1
$\begingroup$

I have to estimate the amplitude of vibration of a real world robot.

The signal is originating from a laser distance measurement, and the vibrations are somewhere between 45 and 60 Hz.

I'm using matlab.

I have 2 options to estimate the amplitude of my signal:

  1. Apply an FFT with a Hanning window, then select the maximum peak in the window [45;60]Hz, then calculate amplitude with this relationship: Amplitude = FFTPeakValue/amountOfSample*2 ( I have to multiply by 2 because signal is symmetric around SamplingFrequency/2, and I'm looking at one side only).
  2. Apply a pass band filter between [45;50], then calculate the amplitude with this relationship: Amplitude=maxPeaktoPeak/2;

    Are both way viable according to you ? Is one of them better?

$\endgroup$
  • $\begingroup$ A much, much better solution can be found here: forum.gambas.one/viewtopic.php?f=4&t=728 I am currently working on a blog article which explains the code, but you can find references to the math in the post. $\endgroup$ – Cedron Dawg Jul 11 at 15:05
  • $\begingroup$ are there any other signals added to your signal of interest? $\endgroup$ – Marcus Müller Jul 11 at 15:26
  • $\begingroup$ just some abiant noise (people walking around etc...) $\endgroup$ – n0tis Jul 11 at 15:37
1
$\begingroup$

What you describe is a very simple signal model: one tone in a constrained frequency range, and superimposed non-sinusoidal noise.

You can do a lot of things based on that. For example, you could do the FM radio / lock-in amplifier dance, and just use a PLL (with a low control loop filter bandwidth, to remove most of the noise!) to lock onto the tone; using the resulting tone to mix your signal, aggressively low-pass filter it and simply take the average amplitude of the resulting signal.

You could also use (other) parametric estimators.

So, to me, estimation would roughly work like this:

  1. band pass filter so that you only retain the signal of interest; preserving a bit of roll-off for the filter, that'd be something like filtering to 40–65 Hz. That gives you a remaining information-containing signal bandwidth of 25 Hz, so decimate your signal in the filtering step down to a sampling rate of 50 Hz. The rest of the signal doesn't contain anything you care about, so you're not losing anything by doing so!
  2. The resulting signal will only contain the little noise power that falls into that bandwidth, plus the signal we care about. So, that's really a simple signal model now! Apply a suitable parametric estimator.

W.r.t. what a suitable parametric estimator would be:

  • If your SNR in this very reduced bandwidth is very good (and that's not unlikely!), calculate the analytic signal, and simply calculate the arctan of the ratio of successive samples of that. Apply some averaging/low-pass filtering to the result to get rid of remaining noise influences. It's not fast, it's not overly stable, but it's easy to grok (frequency is the angular velocity with which the signal runs along a origin circle in the imaginary plane). Frequency resolution: Defined by the accuracy of your arctan implementation (and of course limited by noise).
  • If your SNR is so-and-so, and you can live with limited resolution: Take $m$ samples of input. Concatenate $N-m$ zeros, so that you get an $N$-long zero-padded vector. Do the FFT of that. You'll get a PSD estimate with $N$ equidistant points within your bandwidth. Find the three strongest adjacent bins. You know the actual frequency of your tone is somewhere between these, on the maximum of a sinc running through these three bins. Since close to its maximum, a sinc is pretty similar to a quadratic function, use the highschool formulas to find the maximum of that sinc from the three points. Resolution is mainly limited by SNR, but this algorithm is somewhat more sensitive to noise than others.
  • Else, I'd recommend doing ESPRIT. A bit over the top, but gives you a frequency estimator that's pretty close to the Cramér-Rao Lower Boundary for short observations, and pretty stable in the presence of non-sinusoidal noise. Also, easy to adapt to more than one tone (simply change one parameter). The calculations involved (one vector-vector product, one quasi-pseudoinverse, two eigenvalue decompositions) are benign enough for your rates.
$\endgroup$
1
$\begingroup$

I have written my blog article to explain how the program I referenced works.

https://www.dsprelated.com/showarticle/1284.php

Since the possible range is so wide, a FFT would be a good approach instead of a priori knowledge of which two bins are biggest. Find the peak bin, choose the larger neighbor as the second bin, apply the formulas. In the noiseless case real pure tone case it will yield an exact answer, independent of the sample count. The FFT is a very good "band pass filter" in this regard so no preprocessing should be necessary.

If the frequency is very close to a bin, the parameters can be read right from the bin. In hyper precise applications (frequency within .0000001 or so), I have different equations for and exact answer in the phase and amplitude calculation. Also, in this case my three bin frequency formula should be used centered at the peak.

https://www.dsprelated.com/showarticle/773.php

A comparison of my three bin formula to other approaches can be found here:

http://www.tsdconseil.fr/log/scriptscilab/festim/freqestim-comp.pdf

As you can see it outperforms all the others, especially in the high SNR region. In the zero noise single pure tone case, it is also exact. When the frequency is between the two bins, the two bin formula outperforms the three bin formula in my noise testing. With no noise, both are exact.

The sample program uses 16 samples. With noise present, you will want to use as many points as possible. If efficiency is required, you can do a FFT on a subset of your points on the full interval (select every Mth point), get a rough estimate of the frequency, then calculate the two DFT bins surrounding the peak using all the points.

Ced

$\endgroup$

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.