0
让我们说我有一个numpy矩阵A
,它的大小为Nx2
。我在做什么,在计算第一列的4象限反正切,第二列,像这样:Python中的math.atan2()函数的向量化示例
import math
for i in xrange(A.shape[0]):
phase[i] = math.atan2(A[i,0], A[i,1])
我却想做到这一点的量化方式。我怎样才能做到这一点? math.atan2()函数似乎不支持向量化。
谢谢!
不知道我是怎么错过的。谢谢! – TheGrapeBeyond
有没有办法让我在角度从0到360的情况下给出结果? – TheGrapeBeyond
查看['np.rad2deg'](https://docs.scipy.org/doc/numpy/reference/generated/numpy.rad2deg.html#numpy.rad2deg)。并且不要忘记接受来自@mgilson的答案(点击支票) –