功能:编写的计算皮亚诺相关系数 开发语言:ruby 调用:correlate(x,y) 其中,x,y为需要计算相关度的向量 调用示例: a = [3, 6, 9, 12, 15, 18, 21] b = [1.1, 2.1, 3.4, 4.8, 5.6] c = [1.9, 1.0, 3.9, 3.1, 6.9] c1 = correlate(a,a) # 1.0 c2 = correlate(a,a.reverse) # -1.0 c3 = correlate(b,c) # 0.8221970228 puts c1#,c2,c3