def plot_ellipses(self):
q = 0.60
r = ops.get_ellipse_rad(q)
H = ops.get_hessian(self.X)
eigv, rotation = la.eigh(H)
center = self.Bh
u = np.linspace(0.0, 2.0 * np.pi, 100)
v = np.linspace(0.0, np.pi, 100)
x = (r/math.sqrt(eigv[0]))* np.outer(np.cos(u), np.sin(v))
y = (r/math.sqrt(eigv[1])) * np.outer(np.sin(u), np.sin(v))
z = (r/math.sqrt(eigv[2])) * np.outer(np.ones_like(u), np.cos(v))
for i in range(len(x)):
for j in range(len(x)):
[x[i,j],y[i,j],z[i,j]] = np.dot([x[i,j],y[i,j],z[i,j]], rotation) + center
plt.plot(z,x)
plt.axis('equal')
plt.show()
评论列表
文章目录