Find Delay - Find delay between two signals

Library

Utility Blocks

Description

The Find Delay block finds the delay between a signal and a delayed, and possibly distorted, version of itself. The block is particularly useful when you want to compare a transmitted and received signal to find the bit error rate, but do not know the delay in the received signal. See Computing Delays for more information about signal delays.

The input port labeled sRef receives the original signal, while the input port labeled sDel receives the delayed version of the signal. The two input signals must have the same sample times.

The output port labeled delay outputs the delay in units of samples. If you select Include "change signal" output port, then an output port labeled chg appears. The chg output port outputs 1 when there is a change from the delay computed at the previous sample, and 0 when there is no change. The delay output port outputs signals of type double, and the chg output port outputs signals of type boolean.

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 Find Delay block stop updating the delay after it computes the same delay value for a specified number of samples. To do so, select the Disable recurring updates check box, 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.

Tips for Using the Block Effectively

Examples

Finding the Delay Before Calculating an Error Rate

A typical use of this block is to determine the correct Receive delay parameter in the Error Rate Calculation block. This is illustrated in Finding the Delay in a Model. In that example, the modulation/demodulation operation introduces a computational delay into the received signal and the Find Delay block determines that the delay is 6 samples. This value of 6 becomes a parameter in the Error Rate Calculation block, which computes the bit error rate of the system.

Another example of this usage is in Computing Delays.

Finding the Delay to Help Align Words

Another typical use of this block is to determine how to align the boundaries of frames with the boundaries of codewords or other types of data blocks. Manipulating Delays describes when such alignment is necessary and also illustrates, in the Aligning Words of a Block Code discussion, how to use the Find Delay block to solve the problem.

Setting the Correlation Window Length

The next example illustrates how to tell when the Correlation window length is not sufficiently large.

The model uses a Delay block to delay a signal by 10 samples, and uses the Find Delay block to compare the original signal with the delayed version. The model then displays the output of the Find Delay block in a scope. If the Correlation window length is 15, the scope shows that the calculated delay is not constant over time, as you can see below.

This result tells you to increase the Correlation window length. If you increase it to 50, the calculated delay stabilizes at 10, as shown below.

Dialog Box

Correlation window length

The number of samples the block uses to calculate the cross-correlations of the two signals.

Include "change signal" output port

If you select this option, then the block has an extra output port that emits an impulse when the current computed delay differs from the previous computed delay.

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.

Algorithm

The Find Delay 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.

See Also

Align Signals, Error Rate Calculation

  


 © 1984-2008- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS