From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

Example Code

Determine Sample Delay Using Cross Correlation

Code and Documents

Attachment

Overview
This example uses cross correlation to determine the sample delay between two signals that are identical but have been shifted.


Description
This examples uses cross correlation to determine the sample delay between two signals that are identical but have been shifted. You can see more information in the example code.

 


Requirements

  • LabVIEW 2012 (or compatible)


Steps to Implement or Execute Code

  1. Download the attached folder to your computer
  2. Open the VI " Cross Correlation Test 2012 NIVerified.vi"
  3. Input the configuration in the control
  4. Run the program

 

Additional Information or References
VI Block Diagram

 Block Diagram.png

 

**This document has been updated to meet the current required format for the NI Code Exchange.**

Doug Farrell
Solutions Marketing - Automotive
National Instruments

National Instruments Automotive Solutions

Example code from the Example Code Exchange in the NI Community is licensed with the MIT license.

Comments
Akihabara
Member
Member
on

What might be the maximum size of the signals? Say, 8 or more million samples each?

Denn_Mann
Member
Member
on

This example can be improved by making the "Cross Correlation" plot be more useful.  Notice how in the example provided the x-axis on the plot is not well labelled and we are forced to take the number shown on the "Sample Delay" indicator as being absolutely right.  Look at the modified version I provided which shows the correct output length of the Rxx(n) operation as well as the correct peak on the graph at index 15.

This is a lot more useful.  Please inspect the graph below.  I hope it helps someone out there.

-Daniel

FixedRxx4.png

I-HAVE-A-DREAM
Member
Member
on

Hello Denn_Mann and thank you for sharing. Please your picture attached is not visible. I mean I can not see or download it. Can you please actualise it ?

Thank you

IHAD

Denn_Mann a écrit:


                       

This example can be improved by making the "Cross Correlation" plot be more useful.  Notice how in the example provided the x-axis on the plot is not well labelled and we are forced to take the number shown on the "Sample Delay" indicator as being absolutely right.  Look at the modified version I provided which shows the correct output length of the Rxx(n) operation as well as the correct peak on the graph at index 15.

This is a lot more useful.  Please inspect the graph below.  I hope it helps someone out there.

-Daniel

FixedRxx4.png


                   
I-HAVE-A-DREAM
Member
Member
on

Thank Doug_L._Bear you for sharing very helpful.