jsv5D
sumA = col(1) + col(3) + col(5) + col(7) + col(9) + col(11) + col(13) + col(15) + col(17)
sumB = col(2) + col(4) + col(6) + col(8) + col(10) + col(12) + col(14) + col(16) + col(18)
put sumA into col(21)
put sumB into col(22)

summag = sqrt(sumA^2 + sumB^2)
put summag into col(23)

for n = 1 to 10 do
 th0 = atan(-cell(22,n)/cell(21,n))
 th1 = if(-cell(21,n) > 0 and cell(22,n) > 0, th0, 0)
 th2 = if(-cell(21,n) < 0 and cell(22,n) > 0, th0 + 180., 0)
 th3 = if(-cell(21,n) < 0 and cell(22,n) < 0, th0 - 180., 0)
 th4 = if(-cell(21,n) > 0 and cell(22,n) < 0, th0, 0)
 cell(24,n) = (th1 + th2 + th3 + th4) / n
end for
