什么是"好" R值比较采用互相关2信号时? [英] What is a "good" R value when comparing 2 signals using cross correlation?

查看:145
本文介绍了什么是"好" R值比较采用互相关2信号时?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我,作为一个有点冗长提前道歉:如果你想跳过所有的背景魔神你可以看到我的问题楼下

I apologize for being a bit verbose in advance: if you want to skip all the background mumbo jumbo you can see my question down below.

这是pretty的多跟进一个问题我previously张贴在如何比较两个维(时间依赖性)信号。其中我得到的答案是使用互相关函数(xcorr在MATLAB),我做到了。

This is pretty much a follow up to a question I previously posted on how to compare two 1D (time dependent) signals. One of the answers I got was to use the cross-correlation function (xcorr in MATLAB), which I did.

也许一些背景信息将是有益的:我想实现一个独立成分分析算法。我的一个正规的测试是:(1)创建测试用例通过(a)产生2随机向量(1x1000),(B)结合的载体成2x1000矩阵(称为S),并通过一个2x2混合乘以这个矩阵(称为A),给我一个新的矩阵(姑且称之为T)。

Perhaps a little background information will be useful: I'm trying to implement an Independent Component Analysis algorithm. One of my informal tests is to (1) create the test case by (a) generate 2 random vectors (1x1000), (b) combine the vectors into a 2x1000 matrix (called "S"), and multiply this by a 2x2 mixing matrix (called "A"), to give me a new matrix (let's call it "T").

在总结:T = A * S

In summary: T = A * S

(2)我再运行ICA算法生成混合矩阵的逆矩阵(所谓的W),(3)乘T的W以(希望)给我一个重建原始信号矩阵(称为X)

(2) I then run the ICA algorithm to generate the inverse of the mixing matrix (called "W"), (3) multiply "T" by "W" to (hopefully) give me a reconstruction of the original signal matrix (called "X")

在总结:X = W * T

In summary: X = W * T

(4)我现在想比较S和X。虽然S和X是2x1000,我简单地比较 S(1:) X(1:) S(2,:) X(2:),其中每一个是1x1000,使得他们一维信号。 (我有另一个步骤,这使得确保这些载体是适当的矢量进行比较,以相互和我也正常化的信号)。

(4) I now want to compare "S" and "X". Although "S" and "X" are 2x1000, I simply compare S(1,:) to X(1,:) and S(2,:) to X(2,:), each which is 1x1000, making them 1D signals. (I have another step which makes sure that these vectors are the proper vectors to compare to each other and I also normalize the signals).

所以,我现在的困惑是如何品位如何关闭 S(1:)匹配,以 X(1:),同样与 S(2,:) X(2:)。

So my current quandary is how to 'grade' how close S(1,:) matches to X(1,:), and likewise with S(2,:) to X(2,:).

到目前为止,我已经使用类似: R1 = MAX(ABS(xcorr(S(1,:),X(1:)))

So far I have used something like: r1 = max(abs(xcorr(S(1,:), X(1,:)))

假设使用互相关函数是去比较两个信号的相似性的一种有效方式,你会被认为是一个很好的R值等级信号的相似性?维基百科指出,这是一个非常主观的领域,所以我推迟到那些谁可能有这方面的经验的更好的判断。

Assuming that using the cross correlation function is a valid way to go about comparing the similarity of two signals, what would be considered a good R value to grade the similarity of the signals? Wikipedia states that this is a very subjective area, and so I defer to the better judgment of those who might have experience in this field.

正如你可能知道,我并不是在所有的一个EE / DSP /统计后台(我是学医的),所以我会通过某种穿越火的洗礼的,现在,我来了AP preciate所有帮助我能。谢谢!

As you might realize, I'm not coming from a EE/DSP/statistical background at all (I'm a medical student) so I'm going through a sort of "baptism through fire" right now, and I appreciate all the help I can get. Thanks!

推荐答案

修改就直接回答你关于R值的问题,见下文)

(edit: as far as directly answering your question about R values, see below)

接近,这将是使用互相关的方法之一。请记住,你必须正常化的幅度和正确的延迟:如果你有信号S1和S2的信号是相同的形状,但一半的幅度和延迟了3个样品,他们仍然完全相关的。

One way to approach this would be to use cross-correlation. Bear in mind that you have to normalize amplitudes and correct for delays: if you have signal S1, and signal S2 is identical in shape, but half the amplitude and delayed by 3 samples, they're still perfectly correlated.

例如:

>> t = 0:0.001:1;
>> y = @(t) sin(10*t).*exp(-10*t).*(t > 0);
>> S1 = y(t);
>> S2 = 0.4*y(t-0.1);
>> plot(t,S1,t,S2);

这些应该有一个完美的相关系数。一种方法来计算,这是使用最大互相关:

These should have a perfect correlation coefficient. A way to compute this is to use maximum cross-correlation:

>> f = @(S1,S2) max(xcorr(S1,S2));

f = 

    @(S1,S2) max(xcorr(S1,S2))

>>  disp(f(S1,S1)); disp(f(S2,S2)); disp(f(S1,S2));
   12.5000

    2.0000

    5.0000

xcorr的最大值()负责信号之间的时间延迟。至于校正幅度的话,你可以正常化的信号,使他们的自我互相关为1.0,或者可以折叠的等价步骤分为以下几个:

The maximum value of xcorr() takes care of the time-delay between signals. As far as correcting for amplitude goes, you can normalize the signals so that their self-cross-correlation is 1.0, or you can fold that equivalent step into the following:

&rho沸石; 2 = F(S1,S2) 2 /(F(S i,S 1)* F(S2,S2);

ρ2 = f(S1,S2)2 / (f(S1,S1)*f(S2,S2);

在这种情况下,与RHO; 2 = 5 * 5 /(12.5×2)= 1.0

In this case ρ2 = 5 * 5 / (12.5 * 2) = 1.0

您可以解和RHO;本身,即与RHO; = F(S1,S2)/开方(F(S1,S1)* F(S2,S2)),只需记住,1.0和-1.0完全相关(-1.0具有相反的符号)

You can solve for ρ itself, i.e. ρ = f(S1,S2)/sqrt(f(S1,S1)*f(S2,S2)), just bear in mind that both 1.0 and -1.0 are perfectly correlated (-1.0 has opposite sign)

试着在你的信号!


对于使用什么样的门槛,接受/拒绝,这实际上取决于什么样的信号,你有。 0.9以上是相当好的,但可能会产生误导。我会考虑看你后,你减去的相关版本的残差信号。

with respect to what threshold to use for acceptance/rejection, that really depends on what kind of signals you have. 0.9 and above is fairly good but can be misleading. I would consider looking at the residual signal you get after you subtract out the correlated version. You could do this by looking at the time index of the maximum value of xcorr():

>> t = 0:0.001:1;
>> y = @(a,t) sin(a*t).*exp(-a*t).*(t > 0);
>> S1=y(10,t);
>> S2=0.4*y(9,t-0.1);
>> f(S1,S2)/sqrt(f(S1,S1)*f(S2,S2))

ans =

    0.9959

这看起来pretty的一个关系不错的。但是,让我们尝试用一个比例配合S2 /转向多种S1的:

This looks pretty darn good for a correlation. But let's try fitting S2 with a scaled/shifted multiple of S1:

>> [A,i]=max(xcorr(S1,S2)); tshift = i-length(S1);
>> S2fit = zeros(size(S2)); S2fit(1-tshift:end) = A/f(S1,S1)*S1(1:end+tshift);
>> plot(t,[S2; S2fit]); % fit S2 using S1 as a basis

>> plot(t,[S2-S2fit]);  % residual

残留有它一定的能量;来感受多少,你可以使用这样的:

Residual has some energy in it; to get a feel for how much, you can use this:

>> S2res=S2-S2fit;
>> dot(S2res,S2res)/dot(S2,S2)

ans =

    0.0081

>> sqrt(dot(S2res,S2res)/dot(S2,S2))

ans =

    0.0900

这表示,残留有大约0.81%的原始信号S2的能量(根均方振幅的9%)的。 (一维信号与其自身的点积将总是等于用本身信号的互相关的最大值。)

This says that the residual has about 0.81% of the energy (9% of the root-mean-square amplitude) of the original signal S2. (the dot product of a 1D signal with itself will always be equal to the maximum value of cross-correlation of that signal with itself.)

我不认为有一个灵丹妙药回答两个​​信号是多么相似对方,但我希望我已经给你一些想法,可能是适用于您的情况。

I don't think there's a silver bullet for answering how similar two signals are with each other, but hopefully I've given you some ideas that might be applicable to your circumstances.

这篇关于什么是"好" R值比较采用互相关2信号时?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆