Matlab Cross correlation vs Correlation Coefficient question
By : user3163707
Date : March 29 2020, 07:55 AM
wish helps you In Matlab xcorr(x,x) gives autocorrelation of signal x. It is not scaled, it's simply a vector of inner products of the signal with shifted versions of itself. In order to scale it, use xcorr(x,x,'coeff'). This command will scale your autocorrelation by signal's energy (in other words it will divide each coefficient by value of coefficient at zero lag). Note that when you're doing crosscorrelation, xcorr(x,y'coeff'), you will not get a value of 1 and zero lag, because the scaling is performed differently. It will only be 1 if you're correlating a signal with itself (I wish SO supported math formulas so that I could write it out for you).

Calculating Correlation Coefficient Between Two Files  Hex Value Histogram Correlation
By : P Green
Date : March 29 2020, 07:55 AM
I hope this helps you . An histogram is a graphic representation of a distribution. A [discrete] distribution is an ordered series of the count of the number of samples of a particular value or in the case of a probability distribution, of probabilty values: the probability that a sample taken at random would have this particular value.

Computing the correlation between the autocorrelation and crosscorrelation for each pair of rows in a matrix
By : Kris Cochrane
Date : March 29 2020, 07:55 AM
this one helps. Make sure you set plot to FALSE for acf, ccf. Then, you can just wrap your code in a call to outer to provide every pair of i and j values. Note that since outer expects a vectorized FUN (e.g. *), we need to vectorize your function: code :
set.seed(1)
m < 4
n < 10
mat < matrix(rnorm(m*n), nrow = m, ncol=n)
lag < 5
outer(1:nrow(mat), 1:nrow(mat),
Vectorize(
function(i, j) {
acf.i < acf(mat[i,],lag.max=lag, plot=F)
ccf.i.j < ccf(mat[i,],mat[j,],lag.max=lag, plot=F)
cor(acf.i$acf,ccf.i.j$acf[(lag+1):(2*lag+1)])
} ) )
# [,1] [,2] [,3] [,4]
# [1,] 1.0000000 0.47035200 0.006371955 0.85880247
# [2,] 0.4133899 1.00000000 0.462744858 0.13327111
# [3,] 0.3573965 0.01882691 1.000000000 0.09358042
# [4,] 0.8570117 0.58359258 0.249930947 1.00000000

How to create a function calculating correlation/correlation matrix using J?
By : GreatEmperorAca
Date : March 29 2020, 07:55 AM
around this issue For practical purposes, @EelVex is right, you should use the libraries shipped with J, as they encapsulate "best practice" as JSoftware perceives it. However, for pedagogical, intellectual, and aesthetic reasons, I am a big fan of Oleg Kobchenko's triumph: code :
corr =: (+/@:* % *&(+/)&.:*:)&( +/%#)
c=:+/@:* % *&(+/)
5!:4<'c'
+ /  +
+ @: + *
+ %
+ + *
+ & + /  +
Cr=: +/@:*&(% +/&.:*:)&( +/ % #)
sum =: +/
of =: @
the_product =: *
after =: &
scaling =: % +/&.:*:
after =: &
standardizing =:  +/%#
corr =: sum of the_product after scaling after standardizing
CR=: (+/@:* % *&(+/)&.:*:)&( +/ % #)
0j20":CR/900000000(+,:)1+i.1000000
_1.00000000000000000000
COR f.
(+/ % #)@:*&( (+/ % #)) % *&(%:@(+/ % #)@:*:@: (+/ % #))
0j20":COR/900000000(+,:)1+i.1000000
_1.00000000000000000000
0j20":c/900000000(+,:)1+i.1000000
1.00000229430253350000
load'stats'
0j20":corr/900000000(+,:)1+i.1000000
_0.99999999999619615000

Calculating crosscorrelation with fft returning backwards output
By : Akhil Krazzymuddlehe
Date : March 29 2020, 07:55 AM

