Matlab の 2 次元相関係数に相当する関数はありますか? 2 つの 1 次元配列で使用したいと思います。 http://www.mathworks.com/help/toolbox/images/ref/corr2.html
編集:私自身の実装
//Assume we have the length and averages of both arrays
//double a_average, b_average
double a_val =0;
double b_val = 0;
double a_sum = 0 ;
double b_sum = 0;
double a_stdev = 0;
double b_stdev = 0;
int size = a.length; // same as b's length
for (int i = 0 ; i < size ; i ++) {
a_val =(a[i]- a_average);
b_val =(b[i] -b_average);
a_sum += a_val;
b_sum += b_val;
a_stdev += Math.pow(a_val,2);
b_stdev += Math.pow(b_val,2);
}
double coefficient = ((a_sum *b_sum)/(a_stdev*b_stdev))
ありがとう