【发布时间】:2017-11-12 04:33:50
【问题描述】:
我有两个矩阵 a 和 b
a = matrix(1:4,ncol=2)
b = matrix(5:8,ncol=2)
现在我想找出这些的谐波平均值并放入第三个矩阵。
一个例子:-
x = a[1,1],y = b[1,1] then harmonic mean of x and y = 2*x*y/(x+y)
期望的输出:-
c = matrix(c(1.666667,4.2,3,5.333333),ncol = 2)
【问题讨论】: