【发布时间】:2021-01-24 15:16:05
【问题描述】:
我正在尝试做这些操作:
width = 23
alpha_i = np.array([1.84704762, 1.7878235 , 1.72701305, 1.66501652, 1.60228591,
1.53930674, 1.47657613, 1.41457961, 1.35376915, 1.29454503])
w_s_i = (wc / c) * d * np.cos(alpha_i)
ws_idx = np.zeros((width, 1)) # vettore che contiene "width" elementi spaziati di 1
ii = 0
for i in range(np.int(np.floor(width / 2)),-np.int(np.floor(width / 2))-1,-1):
ws_idx[ii,:] = i
ii = ii + 1
# eq.(7)
steer_vecs = np.zeros((width, alpha_i.shape[0]));
for i in range(0,10):
steer_vecs[:, i] = np.squeeze(np.exp(1j * np.multiply(ws_idx ,w_s_i[i])),axis=1)
但我不知道为什么在最后一个 for 循环结束时,虚部被丢弃.. 我收到以下错误:
ComplexWarning: Casting complex values to real discards the imaginary part
有什么建议吗?谢谢!
【问题讨论】:
标签: python numpy variable-assignment complex-numbers