从非周期性离散时间信号中删除未知的直流偏移

发布于 2024-11-28 18:27:49 字数 386 浏览 0 评论 0原文

是否有某种过程可以确定/消除非周期性离散时间信号中的未知直流偏移?

相关信号的采样率为 25Hz,感兴趣的谐波在 0.25 至 3 Hz 之间。

我尝试过使用高通滤波器混合结果,首先我使用了 Fc = 0Hz 的 10 阶高斯,这在消除偏移方面做得很好,但它也严重衰减了 AC,尽管它确实保持了信号形状完好无损,接下来我使用了168 阶等波纹,阻带为 0Hz,通带为 0.25Hz,相移太严重,信号形状太失真,失真可能是如果通带降至 0.1Hz,则相位偏移会减少,但这只会进一步增加相移,我需要将其保持在最低限度。

应用 x - LPF(x) 之前和之后,如 Paul R

在此处输入图像描述

Is there some process that can determine / remove an unknown DC offset from a non-periodic discrete time signal?

The signal in in question has a sample rate of 25Hz and has harmonics of interest between 0.25 and 3 Hz.

I have tried using highpass filters mixed results, first I used a 10th order guassian with Fc = 0Hz, this did a good job of removing the offset but it severly attenuated the AC aswell although it did leave the signal shape intact, next I used a 168th order equilripple with a stopband at 0Hz and passband at 0.25Hz, the phase shift was too severe and the signal shape too distorted, the distortion could probably be reduced if the pass-band was brought down to 0.1Hz but this would just further increase the phase shift which I need to keep to the very minimum.

Before and after applying x - LPF(x), as suggested by Paul R

enter image description here

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(5

月野兔 2024-12-05 18:27:49

我建议在直流处使用陷波滤波器并使用 filtfilt 使其为零相位。

a = [1 , -0.98]; b = [1,-1];

y = filtfilt(b,a,x);

a 的第二个值越接近 -1,缺口就越窄。

I recommend using a notch filter at DC and using filtfilt to make it zero phase.

a = [1 , -0.98]; b = [1,-1];

y = filtfilt(b,a,x);

The closer the second value of a gets to -1 the narrower your notch will be.

你怎么这么可爱啊 2024-12-05 18:27:49

直流偏移意味着将某个恒定值添加到信号中(该名称源自将直流电压添加到模拟交流信号中)。如果直流分量确实恒定(并且变化不是很慢),那么您不必设计一些高阶(且可能不稳定)高通滤波器 - 您只需从信号中减去信号的平均值即可 -当然,这也是一个高通滤波器(平均是一种低通滤波器,“1 减去平均值”就是高通滤波器)——但非常简单。

另一方面,如果您有理由相信直流分量实际上不是直流分量,而是频率非常低的交流分量,那么您最好对信号的各个部分进行平均,而不是对整个信号进行平均,这与使用脉冲响应比信号长度短的低通滤波器相同。在这种情况下,您必须对“DC”分量做出一些假设。

A DC offset means that some constant value was added to the signal (the name originates from adding a DC voltage to an analog AC signal). If the DC component is really constant (and not changing really slowly), then you don't have to design some high-order (and potentially unstable) high-pass filters - you can just subtract the average of your signal from the signal - which is, of course, a high-pass filter as well (averaging is a type of a low-pass, and '1 minus the average' is high-apss) --- but a very simple one.

If, on the other hand, you have a reason to believe that the DC component is not really a DC, but rather an AC with very low frequency, then you'd better average segments of your signal and not the signal as a whole, which is the same as using a low-pass filter with impulse response which is shorter then the length of the signal. In this case you have to make some assumptions about the "DC" component.

习惯成性 2024-12-05 18:27:49

您可能想考虑实现一个低通滤波器,而不是直接实现高通滤波器(对于非常低的频率,这可能相当棘手 - 您最终会得到大量系数以及稳定性和通带纹波等各种问题)这将为您提供 DC 偏移值的估计,然后从信号中减去该滤波后的偏移,即,而不是:

y = HPF(x)

执行以下操作:

y = x - LPF(x)

低通滤波器可能只是一个相当简单的滤波器,具有相对较少的项数。这种实现的一大优点是,您的高频组件不应因相位、纹波等而产生任何不需要的伪影,因为您所做的只是从样本中减去几乎固定的 DC 值。

唯一潜在的缺点是,如果直流偏移很大,在准确估计直流偏移之前,您可能需要相当长的初始稳定时间(当然,对于任何其他实现(例如直接高通滤波器)也是如此) 。如果您对偏移值可能是什么有任何先验知识(例如,如果它在每次运行中变化不大,并且您知道上一次运行的值),那么您通过将 LPF 状态变量初始化为合适的值而不是 0,可以使用它来优化稳定时间。

Rather than implementing a high pass filter directly (which can be rather tricky for very low frequencies - you end up with a large number of coefficients and various issues with stability and passband ripple etc), you might instead want to consider implementing a low pass filter which will give you an estimate of the DC offset value, and then subtract this filtered offset from your signal, i.e. rather than:

y = HPF(x)

do this:

y = x - LPF(x)

The low pass filter can probably just be quite a simple filter with a relatively small number of terms. The big advantage of this implementation is that your higher frequency components should not have any unwanted artefacts due to phase, ripple, etc, since all you are doing is subtracting an almost stationary DC value from the samples.

The only potential downside is that if the DC offset is large you may have quite a long initial settling time before the estimate of the DC offset is accurate (although this is also true of any other implementation such as a direct high pass filter of course). If you have any a priori knowledge of what the offset value is likely to be (e.g. if it doesn't change very much from run to run, and you know the value from the previous run) then you can use this to optimise the settling time, by initialising the LPF state variables to a suitable value rather than 0.

她说她爱他 2024-12-05 18:27:49

正如其他人所说,要消除直流偏移,您只需减去平均值即可。您的信号不需要是周期性的,但它确实需要足够长才能很好地估计直流分量。

如果您仍然希望采用滤波方法,可以使用 filtfilt。此函数向前过滤一次时间序列,然后向后过滤一次,以便消除相位失真。

As others have said, to remove a DC offset, you can simply subtract the mean. Your signal does not need to be periodic, but it does need to be long enough to get a good estimate of the DC component.

If you still wish to go with a filtering approach, you can eliminate the severe distortion due to phase lag by using filtfilt. This function filters your timeseries once in the forwards direction and then once in the reverse direction, so that phase distortions cancel out.

南巷近海 2024-12-05 18:27:49

您可以设计一个对称 FIR 滤波器作为低通滤波器,用于估计 DC,然后从输入信号中减去输出。该滤波器具有恒定的群延迟。

You can design a symmetric FIR filter as the low-pass filter that estimates the DC and then subtract the output from your input signal. This filter has constant group-delay.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文