使用过滤功能生成缺失数据
我有通过 filter() 函数提供的数据向量 - 所述滤波器被构造为发出原始信号的合理近似值,然后用于识别原始数据中的“坏”元素(所述元素通常是由罕见的短期传感器故障,与良好的数据截然不同)。识别出这些不好的元素后,我想回去用一些合理的东西来替换它们。
一种方法是用过滤后的输出替换坏值;然而,输出是用错误值生成的,因此它存在一定程度的不希望有的失真。
理想情况下,我想要一种方法告诉 filter() 假设坏元素丢失了,并且它应该生成缺失值的合理插值(例如,基于周围的值和过滤器的属性)以在构建输出时使用。
有人告诉我,某些工具箱允许插入特殊值(例如,NaN)来指示丢失(但假设行为良好)的数据。
我查看了 Octave 的 filter() 的源代码,没有任何明显的东西跳出来——是否有一个特殊的值(或其他机制)来告诉 filter() 假设行为良好的数据丢失了(并且应该插入为需要)?
I have vectors of data that I feed through the filter() function -- said filter was constructed to emit a reasonable approximation of the original signal that is then used to identify "bad" elements in the original data (said elements are typically caused by infrequent short-duration sensor malfunctions and are quite distinct from good data). After identifying these bad elements, I want to go back and replace them with something reasonable.
One approach would be to replace the bad values with the filtered output; however, the output was generated with the bad values, so it has some amount of undesired distortion.
Ideally, I'd like a way to tell filter() to assume that the bad element[s] are missing and that it should instead generate a reasonable interpolation of the missing value[s] (e.g., based on the surrounding values and the properties of the filter) for use when constructing the output.
I've been told that certain toolboxes allow insertion of special values (e.g., NaN) to indicate missing (but assumed to be well-behaved) data.
I looked at the source code for Octave's filter() and nothing obvious leapt out at me -- is there a special value (or other mechanism) to tell filter() to assume that well-behaved data is missing (and should be inserted as needed)?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
插入
NaN
对此不起作用。filter
函数非常简单——它只是实现了一个 IIR 滤波器。如果您的信号平滑且变化缓慢,您可能只需使用
interp1
根据两侧的良好数据为不良延伸插入新值即可。如果你的信号有更复杂的频谱内容,我认为“维纳插值”是谷歌搜索的相位。对于外推,您可以使用线性预测编码 。
Inserting
NaN
won't work for this. Thefilter
function is pretty simple--it simply implements an IIR filter.If your signal is smooth and slowly-changing, you might get away with simply using
interp1
to interpolate new values for the bad stretches based on the good data on either side.If your signal has more complicated spectral content, I think "Wiener interpolation" is the phase to google for. For extrapolation you can use linear predictive coding.