您的采样信号看起来像
x(n)=Asin(2πfnfs+ϕ)+B+e(n)
其中$A$是幅度,$\phi$是相位,$f$是正弦信号的频率,$f_s$是采样频率,$B$是直流偏移,$e(n)$是一些加性噪声,希望是零均值。$A$、$f$、$\phi$、$B$ 和 $e(n)$ 未知,您想知道 $B$。A is the amplitude, ϕ is the phase, f is the frequency of the sinusoidal signal, fs is the sampling frequency, B is the DC offset, and e(n) is some additive noise, hopefully with zero mean. A, f, ϕ, B, and e(n) are unknown, and you would like to know B.
您对信号进行平均的想法是估计 $B$ 的一个完全有效的选择(如果加性噪声 $e(n)$ 的平均值确实为零)。您注意到的问题当然是您永远不知道采样数据中是否有整数个周期。要改进您的解决方案,您可以尝试以下方法。获取大量数据。你的块长度 $N$ 必须满足 $$N\gg \frac{f_s}{f}\tag{1}$$ 然后创建足够长度的子块(仍然满足(1))。要获得子块,只需从原始数据块中删除重叠块。通过这种方式,您可以相对于数据块的开头和结尾引入信号的随机相位,如果您对每个子块进行平均,然后对所有子块的结果进行平均,您将获得更好的结果总估计。B (if the additive noise e(n) has indeed a mean value of zero). The problem you have noted is of course that you never know if there is an integer number of periods in your sampled data. To improve on your solution you could try the following. Take a large block of data. Your block length N must satisfy
N≫fsf(1)
Then create sub-blocks of sufficient length (still satisfying (1)). To get your sub-blocks simply cut out overlapping blocks from your original block of data. In this way you introduce a random phase of your signal with respect to the beginning and end of the data blocks, and if you average over each sub-block, and then average the results of all sub-blocks, you'll get a better total estimate. Say your estimate based on the
ith sub-block is
Bi^=1M∑n=nini+M−1x(n)
$M$ 是子块中数据样本的数量,那么您对 DC 偏移的最终估计将是M the number of data samples in the sub-blocks, then your final estimate of the DC offset would be
B^=1L∑i=0L−1Bi^
其中 $L$ 是子块的数量。L is the number of sub-blocks.