On 8/24/11 1:32 PM, Vladimir Vassilevsky wrote:> > > 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.well, both will be in the ballpark of "1" (or 10^0). what if x(t) = 100*sin(Wt) + sin(3Wt) or even x(t) = 100*sin(Wt) + 100*sin(3Wt) ? then, from the FFT bins, you'll have an idea that the amplitude is in the ballpark of 10^2>> 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.i'm including the window in the RMS. and we know that the peak (the "max" norm or the L-inf norm) is somewhere in between the RMS value (the Euclidian norm or L-2 norm) and the sum of abs value of bins (N times the "taxicab" norm or L-1 norm). knowing the L-2 and L-1 norms tells us something.> >> 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?maybe that's all you have stored in the record. or whatever packet of data that is received from a remote location. the point is that the information is in there somewhere.>> so the bin data somehow has that information buried in it. > > It sure does. But what is the point? >i dunno. -- r b-j rbj@audioimagination.com "Imagination is more important than knowledge."
measuruement of peak amplitude of each cycle of sinusoid having varying frequency
Started by ●August 22, 2011
Reply by ●August 24, 20112011-08-24
Reply by ●August 25, 20112011-08-25
On 8/24/2011 1:01 PM, 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? 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.Yesbut: Presumably, a cycle corresponds pretty well with the samples that fall between sign changes, say from minus to plus. Finding the maximum and minimum on that interval is a simple O(n) sorting operation. Refining those points with quadratic interpolation may be worth while. Jerry -- Engineering is the art of making what you want from things you can get.
Reply by ●August 25, 20112011-08-25
On Tue, 23 Aug 2011 13:21:52 -0500, Vladimir Vassilevsky <nospam@nowhere.com> wrote:> > >Eric Jacobsen wrote: > >> On Sun, 21 Aug 2011 23:03:18 -0700 (PDT), sanaashaukat@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. >>> >> Look into windows that provide flat-topped frequency response. These >> are used in spectrum analyzers for the purpose you mention. > >Dear doctor Jacobsen, > >A sinusoid with variable frequency is not a sinusoid. Hence any FFT >based method will produce a wrong result for amplitude.One could argue that a sinusoid without infinite duration is also not a sinusoid. Since such things do not exit one could then conclude that any FFT based method will produce a wrong result for amplitude for any signal given to it. Most of us can see beyond that. Eric Jacobsen http://www.ericjacobsen.org http://www.dsprelated.com/blogs-1//Eric_Jacobsen.php
Reply by ●August 26, 20112011-08-26
>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. >Is it possible for you to upload a measurement? There is a chance it can give you better feedback...
Reply by ●August 30, 20112011-08-30
On Mon, 22 Aug 2011 15:36:48 GMT, eric.jacobsen@ieee.org (Eric
Jacobsen) wrote:
[Snipped by Lyons]
>
>Look into windows that provide flat-topped frequency response. These
>are used in spectrum analyzers for the purpose you mention. In the
>past HP/Agilent et al have published white papers, etc., on this topic
>that are publically available.
>
>
>Eric Jacobsen
Hi Eric,
in case it's of value to anyone, a description
of a novel flat-top window is at:
http://www.dspguru.com/dsp/tutorials/reducing-fft-scalloping-loss-errors-without-multiplication
See Ya',
[-Rick-]
Reply by ●August 30, 20112011-08-30
On Tue, 23 Aug 2011 07:59:15 -0700 (PDT), Dave <dspguy2@netscape.net> wrote:>On Aug 22, 11:36�am, eric.jacob...@ieee.org (Eric Jacobsen) wrote:[Snipped by Lyons]>> >> Look into windows that provide flat-topped frequency response. � These >> are used in spectrum analyzers for the purpose you mention. � In the >> past HP/Agilent et al have published white papers, etc., on this topic >> that are publically available. >> >> Eric Jacobsenhttp://www.ericjacobsen.orghttp://www.dsprelated.com/blogs-1//Eric_Jacobsen.php > >The flattop windows are also given in the Bruel and Kjar (spelling ?) >manuals as well. Last time I looked they were available online. > >Cheers, >DavidHello David, two useful web pages are: http://www.bksv.com/doc/bv0031.pdf and http://www.dspguru.com/dsp/tutorials/reducing-fft-scalloping-loss-errors-without-multiplication See Ya', [-Rick-]
Reply by ●August 30, 20112011-08-30
On Aug 26, 3:58�am, eric.jacob...@ieee.org (Eric Jacobsen) wrote:> On Tue, 23 Aug 2011 13:21:52 -0500, Vladimir Vassilevsky > > > > > > <nos...@nowhere.com> wrote: > > >Eric Jacobsen wrote: > > >> On Sun, 21 Aug 2011 23:03:18 -0700 (PDT), 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. > > >> Look into windows that provide flat-topped frequency response. � These > >> are used in spectrum analyzers for the purpose you mention. > > >Dear doctor Jacobsen, > > >A sinusoid with variable frequency is not a sinusoid. Hence any FFT > >based method will produce a wrong result for amplitude. > > One could argue that a sinusoid without infinite duration is also not > a sinusoid. � Since such things do not exit one could then conclude > that any FFT based method will produce a wrong result for amplitude > for any signal given to it. > > Most of us can see beyond that. > > Eric Jacobsenhttp://www.ericjacobsen.orghttp://www.dsprelated.com/blogs-1//Eric_Jacobsen.phpThe only case when the DFT coefficients are related to time domain amplitude, is when the sinusoidal coincides with a DFT basis function. Consider a sinusoidal of length N and frequency (K+1)/2, K being some integer < N/2. No noise, quantization or anything like that; a perfect sinusoidal. Now compute its N-length DFT. How can you use the coefficientd to deduce the time domain amplitude of the sinusoidal? Rune
Reply by ●August 30, 20112011-08-30
On Tue, 30 Aug 2011 16:03:57 -0700 (PDT), Rune Allnor <allnor@tele.ntnu.no> wrote:>On Aug 26, 3:58=A0am, eric.jacob...@ieee.org (Eric Jacobsen) wrote: >> On Tue, 23 Aug 2011 13:21:52 -0500, Vladimir Vassilevsky >> >> >> >> >> >> <nos...@nowhere.com> wrote: >> >> >Eric Jacobsen wrote: >> >> >> On Sun, 21 Aug 2011 23:03:18 -0700 (PDT), 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. >> >> >> Look into windows that provide flat-topped frequency response. =A0 The= >se >> >> are used in spectrum analyzers for the purpose you mention. >> >> >Dear doctor Jacobsen, >> >> >A sinusoid with variable frequency is not a sinusoid. Hence any FFT >> >based method will produce a wrong result for amplitude. >> >> One could argue that a sinusoid without infinite duration is also not >> a sinusoid. =A0 Since such things do not exit one could then conclude >> that any FFT based method will produce a wrong result for amplitude >> for any signal given to it. >> >> Most of us can see beyond that. >> >> Eric Jacobsenhttp://www.ericjacobsen.orghttp://www.dsprelated.com/blogs-1= >//Eric_Jacobsen.php > >The only case when the DFT coefficients are related to >time domain amplitude, is when the sinusoidal coincides >with a DFT basis function. > >Consider a sinusoidal of length N and frequency (K+1)/2, K being >some integer < N/2. No noise, quantization or anything like that; >a perfect sinusoidal. > >Now compute its N-length DFT. > >How can you use the coefficientd to deduce the time >domain amplitude of the sinusoidal? > >RuneIf the DFT input is composed of a single sinusoid that is monochromatic, or a single frequency, or whatever one wishes to call it, and the three coefficients around the DFT maximizer are known, then one can deduce both the amplitude and frequency, regardless of the relationship of the input frequency to the basis function frequencies. This assumes that the window function is known. If the frequency is not constant across the DFT window then there'll be some additional, but deterministic, smearing. If some things are known about how the frequency is changing, then the amplitude may still be able to be accurately estimated. My comment to Vlad was much more academic, though. Eric Jacobsen http://www.ericjacobsen.org http://www.dsprelated.com/blogs-1//Eric_Jacobsen.php
Reply by ●August 30, 20112011-08-30
On Aug 21, 11:03�pm, 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.You FFT length is so short that the result is in the first few bins. I would not use a window, as even a flat-top window will distort the first few bins of an FFT result. If computational resources are not constrained, I would use an iterative approach. Use an FFT to estimate the frequency. Use a combination of resampling and/or different length FFTs, and iterate with different resampling or FFT lengths until you have your near-sinusoid signal centered in one FFT bin. Perhaps offset the sample vector until the phase of the sin component of the FFT result is zero. Then, with the majority of you signal in one bin (where a window is no longer needed, as it would be little "spectral leakage"), estimate the magnitude from that one FFT bin. I recommend sync resampling for the interpolator. You can also use non-power-of-2 FFTs until you get some combination that fits exactly N cycles of your signal. You probably can get convergence with only a few trial FFTs for initial frequency estimation until you find a good 1 bin fit. IMHO. YMMV. -- rhn A.T nicholson d.0.t com http://www.nicholson.com/rhn/dsp.html
Reply by ●August 30, 20112011-08-30
On Aug 30, 6:22�pm, Ron N <ron.nichol...@gmail.com> wrote:> On Aug 21, 11:03�pm, 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. > > You FFT length is so short that the result is in the first few > bins. > > I would not use a window, as even a flat-top window will distort > the first few bins of an FFT result. �If computational resources > are not constrained, I would use an iterative approach. �Use an > FFT to estimate the frequency. �Use a combination of resampling > and/or different length FFTs, and iterate with different resampling or > FFT lengths until you have your near-sinusoid signal centered in > one FFT bin. �Perhaps offset the sample vector until the phase > of the sin component of the FFT result is zero. �Then, with the > majority of you signal in one bin (where a window is no longer > needed, as it would be little "spectral leakage"), estimate the > magnitude from that one FFT bin. > > I recommend sync resampling for the interpolator. �You can also > use non-power-of-2 FFTs until you get some combination that > fits exactly N cycles of your signal. �You probably can get > convergence with only a few trial FFTs for initial frequency > estimation until you find a good 1 bin fit. > > IMHO. YMMV. > -- > rhn A.T nicholson d.0.t comhttp://www.nicholson.com/rhn/dsp.htmlFor frequency estimation from FFT results, I might try a parabolic interpolation when far off, and a phase vocoder estimator when getting close. rhn






