Evaluation of a four-point sine wave frequency estimator for portable DSP based instrumentation

Evaluation of a four-point sine wave frequency estimator for portable DSP based instrumentation

Measurement 45 (2012) 1866–1871 Contents lists available at SciVerse ScienceDirect Measurement journal homepage: www.elsevier.com/locate/measurement...

453KB Sizes 3 Downloads 134 Views

Measurement 45 (2012) 1866–1871

Contents lists available at SciVerse ScienceDirect

Measurement journal homepage: www.elsevier.com/locate/measurement

Evaluation of a four-point sine wave frequency estimator for portable DSP based instrumentation F. Corrêa Alegria a,b,⇑, Erik Molino-Minero-Re c,d, Shahram Shariat-Panahi c,d a

Instituto de Telecomunicações, Av. Rovisco Pais, 1, 1049-001 Lisbon, Portugal Instituto Superior Técnico, Technical University of Lisbon, Av. Rovisco Pais, 1, 1049-001 Lisbon, Portugal c UPC – Polytechnic University of Catalonia, Rambla Exposició 24, Edifici VG5, 08800 Vilanova i la Geltrú Barcelona, Spain d SARTI – Centre Tecnològic de Vilanova i la Geltrú, Rambla Exposició 24, Edifici VG5, 08800 Vilanova i la Geltrú Barcelona, Spain b

a r t i c l e

i n f o

Article history: Received 1 December 2011 Received in revised form 13 February 2012 Accepted 22 March 2012 Available online 10 April 2012 Keywords: Frequency estimation Sine wave Noise Bias Portable instrumentation

a b s t r a c t A recent frequency estimation method was proposed in a Measurement paper for use in portable DSP based instrumentation. This method is especially important due to its low computational effort making it suitable for fast and low cost instrumentation. It has been found that many parameters can affect the frequency estimation using the proposed method. In this paper, the performance of the method in the presence of additive noise is evaluated, and the influence of signal frequency, initial phase, additive noise and number of analog-to-digital converter bits on the estimator is studied. Some caveats of the practical use of the method are addressed. Detailed numerical simulations based on a Monte Carlo procedure are presented in order to highlight the range of applicability of the method and determine the estimation bias. Ó 2012 Elsevier Ltd. All rights reserved.

1. Introduction Today, frequency estimation of signals is found in many applications as signal processing [1], communications [1– 3], biomedical engineering [4] and consumer electronics [5]. Estimating sine wave parameters is a daily occurrence for an engineer. It is found in different areas as electronic device characterization [6], analog-to-digital testing [7] and sensors. Methods for estimating amplitude, offset, frequency [8] and initial phase are widely known and usually use a least square error approach, as the three and four parameter sine fitting methods published in IEEE standards [6,7]. In new portable instrumentation, which integrate sensing, signal processing, data storage and wireless interfaces, one has to look for low cost, fast and low power solutions. These characteristics can be achieved by minimizing the ⇑ Corresponding author at: Instituto Superior Técnico, Technical University of Lisbon, Av. Rovisco Pais, 1, 1049-001 Lisbon, Portugal. Tel.: +351 218418376; fax: +351 218417972. E-mail address: [email protected] (F. Corrêa Alegria). 0263-2241/$ - see front matter Ó 2012 Elsevier Ltd. All rights reserved. http://dx.doi.org/10.1016/j.measurement.2012.03.029

data processing interval in the frequency estimation. One example of this trend is a new frequency estimation method proposed in a recent Measurement paper [9]. This method uses just four samples to determine the frequency of a single sinusoidal signal. It achieves a fast frequency estimation minimizing the computational power and presenting accurate results under certain conditions. That paper derived the frequency estimator stating: ‘‘. . . for SNR > 45 dB the four-point estimator has good results.’’ ‘‘With high bit numbers representation, instantaneous frequency estimation errors are small.’’ ‘‘This simple estimator is invariant to initial phase.’’ In the following sections we present a more detailed study of the estimator quantifying the influence of signal-to-noise ratio, signal initial phase and deviation of sampling frequency on the frequency estimation and complement the analysis done by the author of [9] in [10] were also estimators for sine wave amplitude [11], offset and initial phase are studied. The effect of quantization, in

F. Corrêa Alegria et al. / Measurement 45 (2012) 1866–1871

1867

particular, has been subject of two other publications by the same author namely [12,13]. In [9] some assumptions were made on the sampling instants and the possibility of obtaining an actual frequency estimate from a given set of data points. We believe that it should be made clearer when this method can and cannot be used and for which range of test parameters it produces good results.

frequency will not be obtained. In applications where the proposed method is used to estimate the signal frequency, in order to avoid the situation mentioned above, the repetition of the data acquisition and frequency estimation procedure has to be implemented until a valid frequency value is obtained.

2. Frequency estimator

The estimator presented in [9] gives the correct value of the signal frequency in the absence of noise. When additive noise is present there is an error in the frequency estimation. In order to evaluate the performance of the estimator we carried out numerical simulation with normalized signal frequency (q) values from 0 to 0.5 (Nyquist frequency). The simulations have been carried out for a signal-to-noise ratio of 45 dB and a sine wave initial phase of p/2. A Monte Carlo procedure is used which entails simulating a signal with given parameters, obtaining four samples and using the estimator (7) to obtain the normalized frequency estimation. This is repeated 100 times (J) and the mean of the expected value ðlq^ Þ is computed. Fig. 1 shows the result of the simulation (circles) where the solid line represents the ideal normalized frequency estimation. The confidence interval for the expected value is also computed and represented by vertical bars for a 99.9% confidence level. Note that for higher values of normalized frequency the length of the confidence intervals is too small to be visible. It can be seen that for low values of signal frequency the effect of noise is considerable. For a SNR of 45 dB and a normalized frequency below 0.05 the estimator performance degrades. To show the effect of additive noise on the estimator, the same simulation was carried out with SNRs of 70 dB, 40 dB and 10 dB and the results are gathered in Fig. 2. The author in [9] state that the sampling frequency has to be four times higher than the signal instantaneous frequency. This corresponds to q = 0.25. Furthermore, the author considers four samples in the T/4 region for the frequency estimation. These statements do not agree with each other. If the samples considered for the frequency estimation have to be in the T/4 region, the sampling frequency has to be at least 12 times higher than the signal

Considering the following sine wave,

xðtÞ ¼ A0 þ A1 sinðXt þ uÞ;

ð1Þ

where A0 is the offset, A1 the amplitude, u the initial phase and X the angular frequency (X = 2pf). Usually ‘‘x’’ is used for angular frequency but we chose to use ‘‘X’’ to keep the same notation as the original paper (Ref. [9]) that introduced the estimator under study. The proposed estimator uses four equally spaced samples (xi) to estimate the angular frequency using

   1 x1  x4 1 ; 2 x2  x3

X ¼ fs acos

ð2Þ

where

xi ¼ x

  i ; fs

i ¼ 1; . . . ; 4:

ð3Þ

The sampling frequency is represented by fs. Inserting (1) into (3) leads to

xi ¼ A0 þ A1 sin



X fs

 iþu ;

i ¼ 1; :::; 4:

ð4Þ

From (1) and (2) it can be seen that the value of the estimated frequency does not depend on the sine wave amplitude or offset. This estimative is exact in the absence of noise. However, when additive noise is present, the estimate is random. In the next sections we look at the error of the estimator, that is, the difference between the actual value of frequency and the mean of the estimator values. In order to simplify the analysis we will used the normalized signal frequency (also called ‘‘digital frequency’’) given by

f fs

q¼ :

3. Influence of additive noise

ð5Þ

The data points can thus be expressed using q as

xi ¼ A0 þ A1 sin ð2pqi þ uÞ:

ð6Þ

We thus have, from (2),



   1 1 y1  y4 acos 1 ; 2p 2 y2  y3

ð7Þ

where yi are the signal samples with added noise (n),

yi ¼ xi þ ni :

ð8Þ

This estimator, however, is only valid if the argument of the arc-cosine function is between 1 and 1. It is important to take into account that, due to noise, this may not happen and consequently an estimation of the signal

Fig. 1. Expected value of estimated normalized frequency as a function of the actual value of normalized frequency. The solid line corresponds to an ideal estimator and the circles represent the simulation values obtained for a SNR of 45 dB. Vertical bars correspond to a 99.9% confidence level.

1868

F. Corrêa Alegria et al. / Measurement 45 (2012) 1866–1871

Fig. 2. Expected value of estimated normalized frequency as a function of the actual value of normalized frequency. The dashed line corresponds to an ideal estimator and the triangles, squares and circles represent the simulation values obtained for a SNRs of 10 dB, 40 dB and 70 dB respectively. Vertical bars correspond to a 99.9% confidence level.

frequency (q P 0.083). The results presented in Fig. 2 show that if the SNR is high enough (SNR P 70 dB), the estimator has a good performance up to the Nyquist ratio which corresponds to q = 0.5. Nevertheless, as the noise level increases the performance of the estimator degrades when q approaches the Nyquist limit, shown in the upper right corner in Fig. 2, or when the ratio q is small (the sampling frequency is much higher than the signals frequency), shown in the lower left corner of Fig. 2. In this last case, because fs is too high, the samples are so close that even small levels of noise produce large errors in the estimator. The author of [9] places the limit of signal-to-noise ratio at 45 dB in order to obtain ‘‘good’’ frequency estimation. However, no simulation or experimental results were presented. In this paper, we have studied the effect of signalto-noise ratio (SNR) on the frequency estimator given in (7). For a signal with q = 0.05, the signal-to-noise ratio was increased from 25 dB to 75 dB in 20 equal intervals and the frequency was estimated using (7). Again, the Monte Carlo method was used to compute the confidence interval with 1000 repetitions in each interval and with a 99.9% confidence level. The mean frequency estimations against SNR are given in Fig. 3 together with the corresponding confidence interval. Fig. 3 shows that as the signal-to-noise increases, the performance of the estimator improves. For q = 0.05 and u = p/2, at 45 dB the error in the frequency estimation of q is about 0.01. This error is about 20% of the normalized signal frequency. Fig. 3 shows that in order to have an error below 2% of the signal frequency in the estimation, the SNR has to be higher than 70 dB. In [10] (Fig. 1) the authors have also studies the influence of SNR. There, however, samples used to estimate the signal frequency are not spaced by 1/fs, as we do here, but by an integer multiple of 1/fs. In conclusion, the manufacturers of the DSP based frequency meters have to focus their efforts in achieving a low noise system for improved frequency estimation using this method. Another ever present consequence of noise is the increase in estimator uncertainty. To access this we

Fig. 3. Expected value of estimated normalized frequency as a function of the signal-to-noise ratio. The vertical bars correspond to a 99.9% confidence level.

computed the standard deviation of the estimator as function of the normalized frequency value for three different values of SNR. The results plotted in Fig. 4 clearly show the effect of noise – the lower the SNR the higher is the estimator uncertainty. We can conclude that for the best values of normalized frequency (in this example it is q  0.25) the standard deviation of the estimated sine wave frequency is less than 0.2% for values of SNR greater than 45 dB and less than 5% for values of SNR greater than 10 dB. 4. Dependence on signal initial phase In [9], the authors say that the frequency estimator is not affected by the signal initial phase without presenting any proof. We have investigated the effect of signal initial phase (u) on the frequency estimator method and found out that indeed the initial phase has a profound effect on the estimator. Fig. 5 shows the effect of signal initial phase on the estimator for a normalized frequency q of 0.1 and a SNR of 37 dB (noise standard deviation of approximately 14 mV for a 1 V sine wave amplitude). The Monte Carlo method is used to find the confidence interval with a probability of 99.9% with 1000 repetitions.

Fig. 4. Standard deviation of estimated normalized frequency as a function of the actual value of normalized frequency for SNRs of 10 dB, 45 dB and 70 dB. Confidence intervals, for a 99.9% confidence level, were computed but are too small to be visible.

F. Corrêa Alegria et al. / Measurement 45 (2012) 1866–1871

u ¼ 1:5p  3pq;

1869

ð11Þ

which can be obtained from (10) by adding p. For the given example, where q = 0.1, the initial phase is found to be u = 0.1  2p. and u = 0.6  2p which can be seen in Fig. 5. Actually we can generalize conditions (10) and (11) by

u ¼ ð0:5 þ kÞp  3pq; k 2 N:

Fig. 5. Expected value of estimated normalized frequency as a function of the signal initial phase. The vertical bars correspond to a 99.9% confidence level.

It can be seen that the expected value of normalized frequency estimation is in accordance with the true value of normalized frequency in this simulation (q = 0.1) except around two values of initial phase, namely u = 0.1  2p and u = 0.6  2p. These two situations correspond to the cases where the four samples taken are symmetrically around the peaks of the sine wave. The first case is depicted in Fig. 6. This positioning of the samples is the most sensitive to presence of additive noise since we have x1  x4 = 0 and x2  x3 = 0. The first condition for the sine wave initial phase that lead to this problem is, from Fig. 6,

p 2

¼ u þ 2p  1:5q:

ð9Þ

The second term of the right side of the equation corresponds to the point in the middle of the four samples (1.5 times the sampling interval). Rewriting for u we get

u ¼ 0:5p  3pq:

ð10Þ

The other condition, corresponding to the situation where the four samples are centered around the negative peak of the sine wave (1.5pu), is

Fig. 6. Representation of the case where the four acquired samples are symmetrically distributed around 2p  1.5q which coincides with the sine wave maximum located at p/2u. The illustration corresponds to a normalized frequency q = 0.125.

ð12Þ

The effects of having x1x4 = 0 and x2x3 = 0 can also be seen in the plots of expected value of estimated normalized frequency as a function of a function of normalized frequency. It was marginally visible in Fig. 2 around the value q = 0.35 but it is more clearly visible in Fig. 7 where a value of initial phase equal to 0.5 rad and a SNR of 20 dB is used. With the signal initial phase changing from 0 to 1, as the noise level increases the performance of the estimator degrades drastically. This can be seen in Fig. 8 for a SNR of 20 dB. These results show that the accuracy of the frequency estimation depends strongly on the initial phase of the sine wave. The recommendation is to trigger the sample acquisition by the input signal and choose a sampling frequency so that the four acquired samples are not distributed around one of the peaks of the sine wave. The best choice would be one where the four samples are around the zerocrossing points of the sine wave. That is,

u ¼ kp  3pq; k 2 N:

ð13Þ

5. Number of bits The analog-to-digital conversion of a signal inevitably adds an error to the data points – the quantization error. It will thus affect the frequency estimation carried out with the method under discussion. The higher the number of bits, the lower the error will be. This is illustrated in Fig. 9 for the case where there is no random voltage noise (SNR = 1). The normalized signal frequency used was the maximum value recommended in [9], that is, the one that leads the four samples to cover one quarter of the sine wave

Fig. 7. Expected value of estimated normalized frequency as a function of the actual value of normalized frequency. The solid line corresponds to an ideal estimator. The confidence intervals are not represented because they are too small to be seen.

1870

F. Corrêa Alegria et al. / Measurement 45 (2012) 1866–1871

Fig. 8. Expected value of estimated normalized frequency as a function of the signal initial phase. The vertical bars correspond to a 99.9% confidence level.

As seen in Fig. 9 for small number of bits the estimation error is substantial. As the number of bits increase the estimation error gets smaller and smaller. for more than 10 bits this error is lower than 0.005%. A similar analysis and conclusion can be found in [10]. The presence of some voltage noise actually improves the estimation error due to signal quantization. The voltage noise acts like dithering effectively improving the analog-to-digital converter resolution. In the case of a SNR of 45 dB we observe in Fig. 10 that for more than 6 bits the error diminished noticeably in comparison to the no-noise situation (Fig. 9). In the case of 11 bits the error is smaller than 0.25%. The conclusion from this analysis is that when using more than 10 bits the errors are very small.

6. Conclusions

Fig. 9. Expected value of estimated normalized frequency as a function of the number of bits when no additive noise is present (circles). Only one estimation was carried out so the expected value is actually the estimation itself. The solid line represents the correct value of normalized frequency (q).

Fig. 10. Expected value of estimated normalized frequency as a function of the number of bits (circles). The vertical bars correspond to a 99.9% confidence level. The solid line represents the correct value of normalized frequency (q).

period (q = 1/12). The initial phase used was also the best one in terms of estimator performance which corresponds to the situation where the four samples are centered on a zero crossing of the sine wave, as per Fig. 6. Since in this case there is no source of random error (voltage noise) the estimator is not random and only one ^Þ. estimation was carried out ðlp^ ¼ p

A recently published paper [9] in the Measurement journal presented a signal frequency estimator based on four signal samples. This frequency estimation method does not present much computational effort which makes it suitable for low cost and fast instrumentation. This paper presents the study of the performance of the frequency estimator when parameters as signal frequency, sampling frequency, quantization error, signal initial phase and signal-to-noise ratio are varied. The first point that should have been made clear in the original paper is that the estimator proposed is not guaranteed to produce an estimate when the signal is corrupted by noise, as is usually the case. This can happen in two cases: (i) when the values of samples are such that the absolute value of the argument of the arc-cosine function in (7) is greater than 1; and (ii) when the value of the second and third samples is the same (x2 = x3) because it leads to a division by 0 in the estimator. These cases are more likely to happen when the four samples are distributed around one of the peaks of the sine wave as illustrated in Fig. 6. It is important to point out that, due to the presence of noise, this problem can, however, happen no matter where the samples are placed relative to the signal period. The simulations carried out show that as the noise level increases the performance of the estimator degrades. In order to have a relative error in the frequency estimation of less than 2%, the SNR has to be greater than 70 dB. The detrimental effect of additive noise is more serious when the samples acquired are distributed around the sine wave peaks, which can happen if the signal initial phase is not carefully chosen. Contrary to what was stated in the original paper the estimator is indeed sensitive to the initial phase. The best case would be to have the four samples distributed around a zero-crossing of the signal, which is difficult to achieve in practice since the frequency of the signal is unknown. The same problem occurs if one wants to follow the suggestion given in [9] of having the four samples span one-fourth of the signal period exactly because the signal period is not known beforehand. We also analyzed the influence of quantization error caused by an analog-to-digital converter and concluded that more than 10 bits should be used to limit the estimation

F. Corrêa Alegria et al. / Measurement 45 (2012) 1866–1871

error to less than 1% for typical values of SNR encountered in practice. The recommendations we make for using this estimator in practical conditions are: (i) to use an analog-to-digital converter with 10 or more bits; (ii) to trigger the data acquisition on a zero-crossing of the signal; and (iii) to choose a sampling frequency higher than 12 times the maximum value of the frequency that the signal is expected to have (but not much higher). Some of these recommendations are implicit in [9], but we believe they should have made this explicit, and this is the main reason that motivated this paper. We also believe that an added benefit of the present paper are the simulations that have been presented, which give a more quantified account of the estimator performance than was done in the original paper. In conclusion, we do believe the estimator proposed in [9] is a good candidate for use in applications where one wants to minimize cost and power consumption and, at the same time, is able to guarantee a high signal-to-noise ratio, medium to high number of bits in analog-to-digital conversion, and has an approximate estimate of the signal frequency to be measured. Acknowledgements The present work was carried out within the framework of the projects SINEOS, reference CTM2010-15459, funded by Spanish Ministry for Science and Innovation (MICINN), and Acción Integrada Hispano-Lusa PT2009-0080, ‘‘Integración de sensores para monitorización submarina en una red con sincronización temporal’’, funded by Spanish and Portuguese Ministry for Science and Innovation.

1871

References [1] R. Hamila, M. Renfors, New maximum likelihood based frequency estimator for digital receivers, in: Proceedings of the IEEE Wireless Communications and Networking Conference 1999, September 1999. [2] C. Bergogne, P. Sehier, M. Bousquet, Reduced complexity frequency estimator for burst transmission, in: Proceedings of the IEEE Global Telecommunications Conference 1995, November 1995. [3] J. Shim, C. Park, D. Kwon, Decision feedback frequency estimator for the coherent DS-CDMA, in: Proceedings of the 48th IEEE Vehicular Technology Conference, May 1998. [4] A. Hoeks, H. Peeters, C. Russien, R. Reneman, A novel frequency estimator for sampled doppler signals, IEEE Transactions on Biomedical Engineering BME-31 (2) (1984) 212–219. [5] P.M. Calvo, J.F. Sevillano, I. Velez, A. Irizar, Reduced cost implementation of low SNR frequency estimators for satellite DVB, in: Proceedings of the International Conference on Consumer Electronics 2005, May 2005. [6] The Institute of Electrical and Electronics Engineers Inc., IEEE 1057IEEE Standard for Waveform Digitizers, 1994. [7] The Institute of Electrical and Electronics Engineers Inc., IEEE 1241IEEE Standard for Terminology and Test Methods of Analog-toDigital Converters, 2000. [8] K. Adachi, H. Suemitsu, T. Matsuo, LMI based frequency estimator with averaging, in: Proceedings of Second International Conference on Innovative Computing, Information and Control 2007, September 2007. [9] D.N. Vizireanu, A simple and precise real-time four point single sinusoid signals instantaneous frequency estimation method for portable DSP based instrumentation, Measurement 44 (2) (2011) 500–502. [10] D.N. Vizireanu, S.V. Halunga, Single sine wave parameters estimation method based on four equally spaced samples, International Journal of Electronics 98 (7) (2011) 941–948. [11] D.N. Vizireanu, S.V. Halunga, Analytical formula for three points sinusoidal signals amplitude estimation errors, International Journal of Electronics 99 (1) (2012) 149–151. [12] D.N. Vizireanu, Quantized sine signals estimation algorithm for portable DSP based instrumentation, International Journal of Electronics, Taylor & Francis 96 (11) (2009) 1175–1181. [13] R.M. Udrea, D.N. Vizireanu, Quantized multiple sinusoids signal estimation algorithm, Journal of Instrumentation, JINST 3, PO 2008, pp. 1–7.