## Find Delay Between Correlated Signals

Three sensors at different locations measure vibrations caused by a car as it crosses a bridge. The signals they produce arrive at the analysis station at different times. The sample rate is 11,025 Hz. Use the Signal Analyzer app to determine the delays between the signals.

Load the signals into the MATLAB® workspace and start the app. The name of each signal includes the number of the sensor that took it. Create three displays. Drag each signal from the Workspace browser to its own display. The signal from Sensor 2 arrives earlier than the signal from Sensor 1. The signal from Sensor 1 arrives earlier than the signal from Sensor 3.

`load sensorData`

Add time information. Select the three signals in the Signal table and click the Time Values button on the Analyzer tab. Select the `Sample Rate and Start Time` option and enter the sample rate of 11,025 Hz. For more information, see Edit Sample Rate and Other Time Information.

The signals share a common time axis. Link their time spans by selecting each display and selecting Link Time on the Display tab.

To estimate the delays between the signals, pan them horizontally and line up a salient feature to the end of the time axis. From the Time tab, read the time from the lower limit of the time-axis. Choose a region where the signal-to-noise ratio is high, such as the signal maximum toward the end of each signal. In the signal from Sensor 2, that feature occurs about 0.197 second after the clock starts.

Similarly, the signal from Sensor 1 has that feature about 0.229 second after the start, and the signal from Sensor 3 has it about 0.243 second after the start. Thus, the delays are approximately 0.032 second and 0.014 second long.

You can also use data cursors to find the delays. Press the space bar to reset the view. On the Display tab, click the arrow under the Data Cursors ▼ and select `Two`. Place a cursor on the maximum of each of the top two signals. You can read the lag of approximately 0.032 second directly from the app.

Similarly, the lag between the top and bottom signals is 0.014 second.

You can get similar results with the `finddelay` and `xcorr` functions.