我在xy平面上有一个尺寸为748x1500的二维温度场“t”。尝试用python numpy编写此函数:
其中G是梯度(倒三角形表示法) 即Gt是t的梯度
Gt=np.gradient(t) # results in a list of two 748x1500 arrays
magGt=np.sqrt(np.power(Gt[0],2),np.power(Gt[1],2)) # |Gt| the magnitude of Gt results in 748x1500 array
GGt=np.gradient(magGt) # G|Gt| results in a list of two 748x1500 arrays
f=np.dot(Gt,GGt) # Gt dot G|Gt| # ValueError: shapes (2,748,1500) and (2,748,1500) not aligned: 1500 (dim 2) != 748 (dim 1)
目前没有回答
相关问题 更多 >
编程相关推荐