DSPRelated.com
Forums

measuruement of peak amplitude of each cycle of sinusoid having varying frequency

Started by Unknown August 22, 2011
On Aug 23, 12:32&#4294967295;pm, Vladimir Vassilevsky <nos...@nowhere.com> wrote:
> Clay wrote: > > On Aug 22, 2:03 am, sanaashau...@hotmail.com wrote: > > >>I am measuring the peak amplitude of each cycle of a sinusoid having > >>frequency of 125Hz but the frequency varies in the range 100Hz to > >>150Hz after around every 3 cycles. I sample the signal for 8ms to > >>capture 1 complete cycle of the sinusoid and then apply 128 point FFT > >>on it to get magnitude and phase information. The algorithm works > >>pretty well if the frequency remains constant at 125Hz however as the > >>frequency changes i get incorrect magnitude and phase due to spectral > >>leakage problem. I tried using windowing but still the results deviate > >>from actual a lot. It has been more than a week I am trying to solve > >>this problem but in vain:( Can any body please help me to solve this > >>issue. > > > Besides, the flat top window suggestion, you could just do everything > > in the time domain and compute the instantaneous envelope. For this > > you need a Hilbert transformer or a pair of phase orthogonal filters. > > On one of the projects, I had to measure an amplitude of approximately > sinusoidal signal with a variable frequency, and with noise, too. Making > a hystogram of samples and estimating the amplitude from that hystogram > is what worked best. > > Vladimir Vassilevsky > DSP and Mixed Signal Design Consultanthttp://www.abvolt.com- Hide quoted text - > > - Show quoted text -
In fact the noise can by dithering the measurements make a statistical method more appropriate for this application. The OP likely needs to try several approaches to see what actually works best or at least good enough for his needs. Clay

Clay wrote:

[...]

Let x(t) ~ A sin(Wt) then x'(t) ~ W cos(Wt)
Assume W is known, then A^2 = x(t)^2 + (x'(t)/W)^2
The problem with this is getting an accurate estimate of x'(t).

It would be good to have a differentiator method which provides a 
derivative of a noisy signal to a given accuracy regardless of W. So we 
don't have to "switch gears" when changing the frequency.

Clay, while ago you mentionned an idea of estimating a derivative of a 
noisy signal with the focus on the end points of the measurement 
interval rather then the center points as the common methods do.
Just wonder what your thoughts are.

VLV
On Aug 23, 4:25&#4294967295;pm, Vladimir Vassilevsky <nos...@nowhere.com> wrote:
> Clay wrote: > > [...] > > Let x(t) ~ A sin(Wt) then x'(t) ~ W cos(Wt) > Assume W is known, then A^2 = x(t)^2 + (x'(t)/W)^2 > The problem with this is getting an accurate estimate of x'(t). > > It would be good to have a differentiator method which provides a > derivative of a noisy signal to a given accuracy regardless of W. So we > don't have to "switch gears" when changing the frequency. > > Clay, while ago you mentionned an idea of estimating a derivative of a > noisy signal with the focus on the end points of the measurement > interval rather then the center points as the common methods do. > Just wonder what your thoughts are. > > VLV
Vlad, You remember well. Yes I was doing regression filters where if viewed like (common implementation) an FIR filter, the coefs are the values of a ramp function. And the magnitudes of the coefs are bigger away from the middle instead of at or near the middle. Thus this will yield an approximation to a derivative. One can certainly try some relatively low order versions (something like 5 to 15 samples) and trade off noise immunity and distortion resulting from a nonconstant derivative. Sounds like time for experimentation. Clay
On Aug 22, 7:03&#4294967295;am, sanaashau...@hotmail.com wrote:
> I am measuring the peak amplitude of each cycle of a sinusoid having > frequency of 125Hz but the frequency varies in the range 100Hz to > 150Hz after around every 3 cycles. I sample the signal for 8ms to > capture 1 complete cycle of the sinusoid and then apply 128 point FFT > on it to get magnitude and phase information. The algorithm works > pretty well if the frequency remains constant at 125Hz however as the > frequency changes i get incorrect magnitude and phase due to spectral > leakage problem. I tried using windowing but still the results deviate > from actual a lot. It has been more than a week I am trying to solve > this problem but in vain:( Can any body please help me to solve this > issue. > > Thanks.
Compute the running average (simple low pass filter would be easy) of the rms and multiply by sqrt(2)? Adjust your filter time constant to get best trade off.
On Aug 23, 4:25&#4294967295;pm, Vladimir Vassilevsky <nos...@nowhere.com> wrote:
> Clay wrote: > > [...] > > Let x(t) ~ A sin(Wt) then x'(t) ~ W cos(Wt) > Assume W is known, then A^2 = x(t)^2 + (x'(t)/W)^2 > The problem with this is getting an accurate estimate of x'(t). > > It would be good to have a differentiator method which provides a > derivative of a noisy signal to a given accuracy regardless of W. So we > don't have to "switch gears" when changing the frequency. > > Clay, while ago you mentionned an idea of estimating a derivative of a > noisy signal with the focus on the end points of the measurement > interval rather then the center points as the common methods do. > Just wonder what your thoughts are. > > VLV
Vlad - the derivative x'(t) = AW cos(Wt), which affects the subsequent solution for A^2. If you're able to make some assumptions about the relative size of A and W you might be able to proceed in a similar manner. Cheers, Dave
On Aug 23, 1:20&#4294967295;pm, Vladimir Vassilevsky <nos...@nowhere.com> wrote:
> steve wrote: > > On Aug 22, 10:55 am, Vladimir Vassilevsky <nos...@nowhere.com> wrote: > > >>sanaashau...@hotmail.com wrote: > > >>>I am measuring the peak amplitude of each cycle of a sinusoid having > >>>frequency of 125Hz but the frequency varies in the range 100Hz to > >>>150Hz after around every 3 cycles. I sample the signal for 8ms to > >>>capture 1 complete cycle of the sinusoid and then apply 128 point FFT > >>>on it to get magnitude and phase information. > > >>Peak value = maxumim value. Find maximum and minimum of your data and > >>here is the peak amplitude. No need for FFTs and such. > > > each sample, when used in a FFT, gives you a indirect estimate of the > > max, no need to throw away all those estimates > > Not quite. That's valid only on assumption that the signal is a perfect > sinusoid. >
That is wrong on so many levels, it's valid for signals consisting of sinusoids corrupted with noise (communications), sinusoids combined with other sinusoids (vibration analysis), tracked varying frequency sinusoids (rotating maching order tracking) etc etc, industries are based on that concept

steve wrote:

> On Aug 23, 1:20 pm, Vladimir Vassilevsky <nos...@nowhere.com> wrote: > >>steve wrote: >> >>>On Aug 22, 10:55 am, Vladimir Vassilevsky <nos...@nowhere.com> wrote: >> >>>>sanaashau...@hotmail.com wrote: >> >>>>>I am measuring the peak amplitude of each cycle of a sinusoid having >>>>>frequency of 125Hz but the frequency varies in the range 100Hz to >>>>>150Hz after around every 3 cycles. I sample the signal for 8ms to >>>>>capture 1 complete cycle of the sinusoid and then apply 128 point FFT >>>>>on it to get magnitude and phase information. >> >>>>Peak value = maxumim value. Find maximum and minimum of your data and >>>>here is the peak amplitude. No need for FFTs and such. >> >>>each sample, when used in a FFT, gives you a indirect estimate of the >>>max, no need to throw away all those estimates >> >>Not quite. That's valid only on assumption that the signal is a perfect >>sinusoid. >> > That is wrong on so many levels, it's valid for signals consisting of
Sorry steve, you need refresher on the basics.
> sinusoids corrupted with noise (communications), sinusoids combined > with other sinusoids (vibration analysis), tracked varying frequency > sinusoids (rotating maching order tracking) etc etc, industries are > based on that concept
FFT tells the amplitudes of each of sinusoidal components. FFT tells nothing about the amplitude of the sum of the components or an amplitude of a non-sinusoidal signal. You can estimate the RMS value, but not the amplitude.
On 8/24/11 11:51 AM, Vladimir Vassilevsky wrote:
>
> FFT tells the amplitudes of each of sinusoidal components. > FFT tells nothing about the amplitude of the sum of the components or an > amplitude of a non-sinusoidal signal.
"nothing", Vlad? what if some FFT bin, X[k] (and it's reflection at X[N-k] ) is much larger than anything else. would you have no idea of the amplitude of the sum of the components?
> You can estimate the RMS value, but not the amplitude.
you can *calculate* the RMS value (because of Parseval's theorem), not merely "estimate". you can get some gross estimate of peak amplitude from the FFT bins, given some assumptions (so it's an *estimate*), but you can *calculate* the peak from the FFT bins by performing an inverse FFT on the data. so the bin data somehow has that information buried in it. -- r b-j rbj@audioimagination.com "Imagination is more important than knowledge."

robert bristow-johnson wrote:

> On 8/24/11 11:51 AM, Vladimir Vassilevsky wrote: > >> > >> FFT tells the amplitudes of each of sinusoidal components. >> FFT tells nothing about the amplitude of the sum of the components or an >> amplitude of a non-sinusoidal signal. > > "nothing", Vlad?
x(t) = sin(Wt) + sin(3Wt) y(t) = sin(Wt) - sin(3Wt) Now take FFT and think about amplitude.
> what if some FFT bin, X[k] (and it's reflection at > X[N-k] ) is much larger than anything else. would you have no idea of > the amplitude of the sum of the components?
First thing I learned at the univercity is that scientists and engineers don't use words like "much" or "larger".
>> You can estimate the RMS value, but not the amplitude. > > you can *calculate* the RMS value (because of Parseval's theorem), not > merely "estimate".
Only if in the trivial case of rectangular window. Otherwise it matters how the signal is positioned wrt window. you can get some gross estimate of peak amplitude
> from the FFT bins, given some assumptions (so it's an *estimate*), but > you can *calculate* the peak from the FFT bins by performing an inverse > FFT on the data.
If you have to do the inverse FT, why doing forward FT first time?
> so the bin data somehow has that information buried in > it.
It sure does. But what is the point? Vladimir Vassilevsky DSP and Mixed Signal Design Consultant http://www.abvolt.com
> On 8/24/11 11:51 AM, Vladimir Vassilevsky wrote: >First thing I learned at the univercity is that scientists and engineers >don't use words like "much" or "larger".
"Much" I can understand, but when did universities begin deprecating "larger" as a valid scientific/engineering term? Steve