how to calculate normalized cross correlations for two signals ????

55 次查看(过去 30 天)
hello
I hope you are doing well and fine
i have two arrays of data for two different signals
i want to compare them using cross correlations
xcorr method is used to get the correlation value and then lag value and i plot it using this code
[tmpr lags]=normxcorr2(powersignal1,power_b_int);
[tmpr1 lags1]=normxcorr2(powersignal1,powerT1);
my problem is that i want to do a normalized cross-correlation as it is more exact and gives better results however i do not know how to do so
is there a function in Matlab that does normalized cross-correlations calculations for different lags and return the results ??
i have been searching for a while yet i could find any
i know the formula for calculating the normalized cross-correlations but hoped for a prepared method to use right a way instead of writting the method thank you so much

采纳的回答

Yuvaraj Venkataswamy
Check this, where x and y are two vector with length N.
if true
Normalised_CrossCorr = (1/N)*sum((x-mean(x))*(y-mean(y)))/(sqrt(var(x)*var(y));
end
  3 个评论
Rohan Dekate
Rohan Dekate 2020-12-17
Hi
I implemented this for a sensor signal and a modelled signal, and got 0.847 as the answer. Correct me if I'm wrong in understanding the concept -
If the Normalized Cross Correlation is 1 it means that the two signals are matching each other and if it is 0 then they are not matching at all. Because it is normalized the answer will be between 0 and 1.
However, I have a simulink model from which I'm generating two signals as output. When I implemented the above formula I got 623700 as my answer which is not plausible at all. Can you tell me what has gone wrong?
Vasanthi Ravindran
Hi Yuvaraj Sir ,
Can you kindly send the formula for Normalised Cross Correlation

请先登录,再进行评论。

更多回答(0 个)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by