Autocorrelation and Crosscorrelation calculation in LabView

(Last Updated On: February 6, 2019)

A LabView sketch was used to simulate the stochastic signals and evaluate the functionality of the autocorrelation function and the spectral power density.

In the next Figure 1 can be seen the used schematic:

Labview block diagram

The white noise is constant over the frequency, and is generated by the frequencies. The source of the white noise is the virtual instrument “Gausian White noise” part of the Digital Processing library of LabView. A sinus wave and a Gausian white noise signal are added. The white noise source alone is autocorrelated and shown in the Figure 2. When a signal have a delta dirac for τ= 0, it can be recognized that a white noise component is there.

 Figure 2: Autocorrelation function of white noise with SD 1

The front panel of the block diagram can be seen in the Figure 3

Figure 3: Front panel LabView simulation

Autocorrelation

Autocorrelation is the correlation of a function with a shifted version of itself. It indicates how the power is distributed within the signal.

To calculate the autocorrelation function, the virtual instrument “AutoCorrelation” was employed. Three signals with different amplitude were compared, 1, 5 and 20 respectively. The 10Hz sinus wave is mixed with a Gaussian noise source with a standard deviation of 1.

10Hz with standard deviation 1. Amplitude is 1

Figure 4: Time domain noisy sinus signal with amplitude 1 and standard deviation of 1

Figure 5: Auto-correlation signal with amplitude 1 and standard deviation of 1

The autocorrelation function was plotted on the Figure 5,Figure 7 and Figure 9. As it can be seen the autocorrelation functions (ACF) is always even, in this case they have symmetry about τ = 1023. For this central value correspond to the mean energy of the sinus signal. As it can be seen on the autocorrelations figures, the greater the amplitude is, bigger is the mean energy of the signal.

10Hz with standard deviation 1. Amplitude is 5

Figure 6: Time domain noisy sinus signal with amplitude 5 and standard deviation of 1

Figure 7: Auto-correlation signal with amplitude 5 and standard deviation 1

10Hz with standard deviation 1. Amplitude is 20

Figure 8: Time domain noisy sinus signal with amplitude 20 and standard deviation of 1

Figure 9: Autocorrelation of a signal with amplitude 20 and noise standard deviation of 1

The bigger the amplitude, less interferes the white noise to the signal. This is due the noise is the same for all the signals

Figure 10: FFT module of amplitude 1

Figure 11: FFT module for amplitude 5

Figure 12: FFT module for a amplitude of 20

When the signal amplitude is greater the noise affects less to the signal. The greater the amplitude is, the signal to noise ratio is, bigger. This can be seen on the previous Figure 10, Figure 11 and Figure 12. When the noise increment, also the SNR decreases after the FFT. This is to be seen in the following Figure 13 and Figure 14.

Amplitude 1. SD 1. 10 Hz

Figure 13: FFT module for standard deviation of 1

Figure 14: FFT module for standard deviation of 3

Crosscorrelation

The crosscorrelation is the correlation function applied to two signals, getting a third one. This obtained signal shows the static dependence of both input signals as a function of the displacement of one relative to the other. For this simulation, the crosscorrelated signals are the previous threated sinus signal and another gausian noise source. This both noise sources are supposed to be independent.

Figure 15: Crosscorrelation of the noisy sinus signal amplitude 1

Figure 16: Crosscorrelation of noisy sinus signal with amplitude 20

From the previous signals, the gausian noise source have some dependencies which each other, but they shouldn’t if they were totally independent sources. Also it can be seen that the changes on the amplitude does not modify the crosscorrelation, since the sinus wave pure signal has no dependency with the gausian noise. The result doesn’t go to zero, because of the finite number of samples.

Spectral power density

The spectral power density is obtained making the Fourier transform of the crosscorrelation function.

Figure 17: Spectral power density for amplitude 1

Figure 18: Spectral power density for amplitude 5

The sensor in the system has, sometimes, the same.

Detection of the sound source position

By using the crosscorrelation function, it can be determined how much delay between the two signals. This delay is proportional to the distance of the two

To simulate this, a zeros array number is added. Adding a delay the number is delayed.

This is used to identify where a noise source is coming from. Three microphones will be needed to estimate exactly the position of the sound source. This method is also used in ultrasonic sensors to measure distances.

Leave a Reply

Your email address will not be published. Required fields are marked *

Scroll to top