Note: This page has been translated by MathWorks. Please click here

To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

Align two signals by finding delay between them

Utility Blocks

The Align Signals block aligns two signals by finding the delay between them. This is useful when you want to compare a transmitted and received signal to determine the bit error rate, but do not know the delay in the received signal. This block accepts a column vector or matrix input signal. For a matrix input, the block aligns each channel independently.

The `s1`

input port receives the original signal,
while the `s2`

input port receives a delayed version.
The two input signals must have the same dimensions and sample times.
The block calculates the delay between the two signals, and then

Delays the first signal,

`s1`

, by the calculated value, and outputs it through the port labeled`s1 del`

.Outputs the second signal

`s2`

without change through the port labeled`s2`

.Outputs the delay value through the port labeled

`delay`

.

See Delays in the Communications System Toolbox™ online documentation for more information about signal delays.

The block's **Correlation window length** parameter
specifies how many samples of the signals the block uses to calculate
the cross-correlation. The delay output is a nonnegative integer less
than the **Correlation window length**.

As the **Correlation window length** is increased,
the reliability of the computed delay also increases. However, the
processing time to compute the delay increases as well.

You can make the Align Signals block stop updating the delay
after it computes the same delay value for a specified number of samples.
To do so, select **Disable recurring updates**, and
enter a positive integer in the **Number of constant delay
outputs to disable updates** field. For example, if you set **Number
of constant delay outputs to disable updates** to `20`

,
the block will stop recalculating and updating the delay after it
calculates the same value 20 times in succession. Disabling recurring
updates causes the simulation to run faster after the target number
of constant delays occurs.

Set the

**Correlation window length**parameter sufficiently large so that the computed delay eventually stabilizes at a constant value. If the computed delay is not constant, you should increase**Correlation window length**. If the increased value of**Correlation window length**exceeds the duration of the simulation, then you should also increase the duration of the simulation accordingly.If the cross-correlation between the two signals is broad, then

**Correlation window length**should be much larger than the expected delay, or else the algorithm might stabilize at an incorrect value. For example, a CPM signal has a broad autocorrelation, so it has a broad cross-correlation with a delayed version of itself. In this case, the**Correlation window length**value should be much larger than the expected delay.If the block calculates a delay that is greater than 75 percent of

**Correlation window length**, the signal`s1`

is probably delayed relative to the signal`s2`

. In this case, you should switch the signal lines leading into the two input ports.If you use the Align Signals block with the Error Rate Calculation block, you should set the

**Receive delay**parameter of the Error Rate Calculation block to`0`

because the Align Signals block compensates for the delay. Also, you might want to set the Error Rate Calculation block's**Computation delay**parameter to a nonzero value to account for the possibility that the Align Signals block takes a nonzero amount of time to stabilize on the correct amount by which to delay one of the signals.

See the Delays section
of * Communications System Toolbox User's Guide* for
an example that uses the Align Signals block in conjunction with the
Error Rate Calculation block.

See Setting the Correlation Window Length, on the reference page for the Find Delay block, for an example that illustrates how to set the correlation window length properly.

**Correlation window length**The number of samples the block uses to calculate the cross-correlations of the two signals.

**Disable recurring updates**Selecting this option causes the block to stop computing the delay after it computes the same delay value for a specified number of samples.

**Number of constant delay outputs to disable updates**A positive integer specifying how many times the block must compute the same delay before ceasing to update. This field appears only if

**Disable recurring updates**is selected.

The Align Signals block finds the delay by calculating the cross-correlations of the first signal with time-shifted versions of the second signal, and then finding the index at which the cross-correlation is maximized.

Was this topic helpful?