比较 2 个一维信号
我遇到以下问题:随着时间的推移,我有 2 个信号。它们来自同一来源,所以它们应该是相同的。我想确认一下他们是不是真的。
并发症:
- 它们可能使用不同的采样率进行测量,
- 开始/结束时间不相关。测量不同时开始和结束。
- 两个信号之间可能存在时间偏移。
我的想法是沿着傅里叶变换、卷积和统计方法进行比较。有人可以给我发布一些链接,我可以在其中找到有关如何处理此问题的更多信息吗?
I have the following problem: I have 2 signals over time. They are from the same source so they should be the same. I want to check if they really are.
Complications:
- they may be measured with different sample rates
- the start / end time do not correlate. The measurement does not start at the same time and end at the same time.
- there may be an time offset between the two signals.
My thoughts go along Fourier transformation, convolution and statistical methods for comparison. Can someone post me some links where I can find more information on how to handle this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
您只需移动它们以使它们的质心对齐即可轻松校正相位。 (或者,在傅立叶域中,只需乘以第一个系数的相位的倒数。)
类似地,如果您想排列仅给出部分数据的图像,您可以只进行互相关并取最大值(即在傅立叶域中也很容易做到)。
这个过程中唯一棘手的部分就是处理采样率。现在,如果您先验地知道采样率是多少(并且它们通过有理数相关),则可以使用 sinc 插值/下采样将它们重新调整为通用采样率:
https://ccrma.stanford.edu/~jos/st/Bandlimited_Interpolation_Time_Limited_Signals.html
如果您不知道采样率,您可能会有点搞砸了。从技术上讲,您可以尝试对信号的所有不同重新缩放进行暴力强制,但这样做往往要么很慢,要么给出平庸的结果。
作为最后一个建议,如果您只想精确匹配声音,您可以尝试使用倒谱并验证信号的峰值是否足够接近于一定的容差范围。这种类型的分析在声音和语音识别中大量使用,并进行了一些改进以使其在本地运行。它最适合处理调频数据,例如语音和音乐:
http://en.wikipedia.org/wiki /倒谱
You can easily correct for the phase by just shifting them so their centers of mass line up. (Or alternatively, in the Fourier domain just multiplying by the inverse of the phase of the first coefficient.)
Similarly, if you want to line up the images given only partial data, you can just cross correlate and take the maximal value (which is again easy to do in the Fourier domain).
That leaves the only tricky part of this process as dealing with the sampling rates. Now if you know a-priori what the sample rates are, (and if they are related by a rational number), you can just use sinc interpolation/downsampling to rescale them to a common sampling rate:
https://ccrma.stanford.edu/~jos/st/Bandlimited_Interpolation_Time_Limited_Signals.html
If you don't know the sampling rate, you may be a bit screwed. Technically, you can try just brute forcing over all the different rescalings of your signal, but doing this tends to be either slow or else give mediocre results.
As a last suggestion, if you just want to match sounds exactly you can try using the cepstrum and verifying that the peaks of the signal are close enough to within some tolerance. This type of analysis is used a lot in sound and speech recognition, with some refinements to make it operate a bit more locally. It tends to work best with frequency modulated data like speech and music:
http://en.wikipedia.org/wiki/Cepstrum
傅里叶变换听起来确实是正确的方法。
对于我来说,这里有太多的数学信息,所以如果你真的想知道这是怎么回事(因为我认为你不能在不理解它的情况下使用 FT),你应该使用来自 MIT OpenCourseWare 的参考资料:< a href="http://ocw.mit.edu/courses/mathematics/18-103-fourier-analysis-theory-and-applications-spring-2004/lecture-notes/" rel="nofollow">http://ocw.mit.edu/courses/mathematics/18-103-fourier-analysis-theory-and-applications-spring-2004/lecture-notes/
希望有帮助。
Fourier transformation does sound like the right way.
There is too much mathematical information for me to just start explaining here so if you really wanna know what's going on with that (cause I don't think you can just use FT without understanding it) you should use this reference from MIT OpenCourseWare: http://ocw.mit.edu/courses/mathematics/18-103-fourier-analysis-theory-and-applications-spring-2004/lecture-notes/
Hope it helped.
如果您使用的是linux box,并且需要处理的波形已经被录制,您可以尝试使用
file
命令来显示有关录制的详细信息。当在 wav 文件上调用它时,它会为您提供采样率,尽管我不确定您正在录制什么格式。如果信号相对于彼此存在时移,您可以尝试将一个与增加延迟的 delta 函数,然后进行比较。在 MATLAB 上,
conv
和all
应该足够好了。这些只是“粗鲁”的尝试(几乎就像破解问题一样)。可能有一些移位不变的算法可以做得更好。
希望有帮助。
If you are working with a linux box and the waveforms that need to be processed have already been recorded, you can try to use the
file
command to display details about the recording. It gives you the sampling rate when it is invoked on a wav file, though I am not sure what format you are recording in.If the signals are time-shifted with respect to each other, you may try to convolve one with a delta function with increasing delays and then comparing. On MATLAB,
conv
andall
should be good enough.These are just 'crude' attempts (almost like hacking at the problem). There may be algorithms that are shift-invariant that may do a better job.
Hope that helps.