主要内容

alplensignals.

Align two signals by delaying earliest signal

描述

example

[Xa,] = alignsignals(X,Y)估计延迟,D, between the two input signals,XY,并返回对齐信号,Xa

  • 如果Yis delayed with respect toX, thenDis positive andX被延迟了Dsamples.

  • 如果Yis advanced with respect toX, thenD是消极的Y被延迟了–Dsamples.

Delays inX要么Y可以通过预先生的零来引入。

example

[Xa,] = alignsignals(X,Y,maxlag)用途maxlag作为最大窗口大小以查找估计延迟,D, between the two input signals,XY。It returns the aligned signals,Xa

example

[Xa,] = alignsignals(X,Y,maxlag,'truncate')keeps the lengths of the aligned signals,Xa,与输入信号相同,XY, respectively.

  • 如果the estimated delay,D,是积极的,然后D零是前面的X和the lastD样本X被截断了。

  • 如果the estimated delay,D, is negative, then –D零是前面的Y和最后一个 -D样本Y被截断了。

Notes

XYare row or column vectors of lengthLXLY, respectively.

  • 如果DLX, thenXaconsists ofLX零。所有样本X丢失了。

  • 如果DLY, thenconsists ofLY零。所有样本Y丢失了。

避免分配特定值maxlagwhen using the'truncate'option, setmaxlagto[]

example

[Xa,,D] = alignsignals(___)返回估计的延迟,D。This syntax can include any of the input arguments used in previous syntaxes.

例子

全部收缩

对齐信号Ywith respect toX通过延迟三个样本。

创建两个信号,XYX与之完全相同Y, exceptX有三个领先的零,另外一个额外的零。对齐两个信号。

x = [0 0 0 1 2 3 0 0];Y = [1 2 3 0];[xa,ya] = alpiensignals(x,y)
Xa =1×80 0 0 1 2 3 0 0
你=1×70 0 0 1 2 3 0

对齐信号XwhenYis delayed with respect toXby two samples.

创建两个信号,XYY与之完全相同X, exceptY有两个领先的零。对齐两个信号。

x = [1 2 3];Y = [0 0 1 2 3];maxlag = 2;[xa,ya,d] = alplensignals(x,y,maxlag)
Xa =1×50 0 1 2 3
你=1×50 0 1 2 3
D = 2

对齐信号Ywith respect toX, despite the fact thatY是一个嘈杂的信号。

创建两个信号,XYY与之完全相同Xwith some noise added to it. Align the two signals.

X = [0 0 1 2 3 0]; Y = [0.02 0.12 1.08 2.21 2.95 -0.09]; [Xa,Ya,D] = alignsignals(X,Y)
Xa =1×60 0 1 2 3 0
你=1×60.0200 0.1200 1.0800 2.2100 2.9500 -0.0900
D = 0

You do not need to change the input signals to produce the output signals. The delayDis zero.

Invoke the'truncate'option when calling thealplensignals.function.

创建两个信号,XYY与之完全相同X, exceptY有两个领先的零。对齐两个信号,应用'truncate'directive.

x = [1 2 3];Y = [0 0 1 2 3];[xa,ya,d] = alplensignals(x,y,[],'truncate')
Xa =1×30 0 1
你=1×50 0 1 2 3
D = 2

Observe that the output signalXahas a length of 3, the same length as input signalX

In the case where using the'truncate'option ends up truncating all the original data ofX, a warning is issued. To makealplensignals.issue such a warning, run the following example.

Y = [0 0 0 0 1 2 3];[xa,ya,d] = alplensignals(x,y,[],'truncate')
警告:第一个输入x中的所有原始数据都被截断,因为x的长度小于估计的延迟d:避免截断此数据不使用“截断”选项。
Xa =1×30 0 0
你=1×70 0 0 0 1 2 3
D = 4

对齐信号Ywith respect toX, despite the fact thatY是一个定期重复的X。返回最小可能的延迟。

创建两个信号,XYYconsists of two copies of the nonzero portion ofX用零分开。对齐两个信号。

X = [0 1 2 3]; Y = [1 2 3 0 0 0 0 1 2 3 0 0]; [Xa,Ya,D] = alignsignals(X,Y)
Xa =1×40 1 2 3
你=1×13.0 1 2 30 0 0 0 1 2 30 0
d = -1

Input Arguments

全部收缩

First input signal, specified as a numeric vector of lengthLX.

例子:[1 2 3]

Data Types:single|双倍的|int8|INT16|INT32.|INT64.|uint8|uint16|uint32|uint64
Complex Number Support:Yes

Second input signal, specified as a numeric vector of lengthl

例子:[0 0 1 2 3]

Data Types:single|双倍的|int8|INT16|INT32.|INT64.|uint8|uint16|uint32|uint64
Complex Number Support:Yes

Maximum window size, or lag, specified as an integer-valued scalar. By default,maxlagis equal tomax(长度(x),长度(y)) - 1。如果maxlag输入为[], it is replaced by the default value. Ifmaxlagis negative, it is replaced by its absolute value. Ifmaxlag不是整数值,或复杂,inf, orNaN, thenalplensignals.returns an error.

例子:2

Data Types:single|双倍的|int8|INT16|INT32.|INT64.|uint8|uint16|uint32|uint64

Output Arguments

全部收缩

对齐的第一信号,作为与第二输出参数对齐的数字矢量返回,。如果输入参数Xis a row vector, thenXa也是一排矢量。如果输入参数X是一列栏矢量,然后Xa也是一列栏矢量。如果您指定了'truncate'option and the estimated delayD那是积极的,然后Xa相当于输入信号XwithDzeros prepended to it and its lastDsamples truncated.

对齐的第二信号,作为与第一个输出参数对齐的数字向量返回,Xa。如果输入参数Yis a row vector, then也是一排矢量。如果输入参数Y是一列栏矢量,然后也是一列栏矢量。如果您指定了'truncate'option and the estimated delayD是消极的,然后相当于输入信号Ywith –Dzeros prepended to it and its last –Dsamples truncated.

Estimated delay between input signals, returned as a scalar integer. This integer represents the number of samples by which the two input signals,XYare offset.

  • 如果Yis delayed with respect toX, thenDis positive andX被延迟了Dsamples.

  • 如果Yis advanced with respect toX, thenD是消极的Y被延迟了–Dsamples.

  • 如果XYare already aligned, thenDis zero and neitherXnorYare delayed.

如果指定输入参数的值maxlag, thenDmust be less than or equal tomaxlag

算法

  • You can find the theory on delay estimation in the specification of thefinddelayfunction (see算法)。

  • Thealplensignals.功能使用估计的延迟D延迟最早的信号,使得两个信号具有相同的起点。

  • As specified for thefinddelayfunction, the pair of signals need not be exact delayed copies of each other. However, the signals can be successfully aligned only if there is sufficient correlation between them. For more information on estimating covariance and correlation functions, see[1]

  • 如果信号具有诸如脉冲或转换的功能,则可以使用测量功能而不是相关性更有效地对齐它们。例如,看到Align Two Bilevel Waveforms

参考

[1] Orfanidis,Sophocles J.最佳信号处理。一个介绍。2nd Ed. Englewood Cliffs, NJ: Prentice-Hall, 1996.

Extended Capabilities

C / C ++代码生成
使用MATLAB®Coder™生成C和C ++代码。