我有这样的线性图: linear plot
我想用以下方法创建极坐标图:
def cart2pol(x, y):
rho = np.sqrt(x**2 + y**2)
phi = np.arctan2(y, x)
return(rho, phi)
但我不明白它是如何工作的。如何使用上述def在极坐标中创建绘图
要创建我正在使用的线性绘图
ax.plot(xd, yd2)
其中:xd=范围(0,50)和yd2=yd[0:50],yd-来自我的信号的数据
下一步:
xd_2 = xd[2:50]
yd3 = yd[2:50]
def cart2pol(xd_2, yd3):
xdkw = np.power(xd_2,2)
yd3kw = np.power(yd3,2)
rho = np.sqrt(xdkw + yd3kw)
phi = np.arctan2(yd3kw, xdkw)
return(rho, phi)
接下来:
plt.polar(cart2pol(xd_2,yd3))
我得到一个错误:
ValueError: x and y can be no greater than 2-D, but have shapes (2,) and (2, 50, 48)
此方法将笛卡尔坐标(x,y)转换为等效极坐标(rho,phi)并返回它
在二维极坐标系中,点由(ρ,φ)表示, 在哪里
将笛卡尔坐标系转换为极坐标系
极坐标可以通过以下方式绘制:
相关问题 更多 >
编程相关推荐