Obvious,最小特征值对应的特征向量为平面的法向
Created on Sun Nov 05 19:37:26 2017 @author: Bambo """ import numpy as np import scipy x=[random.randint(0,100) for i in range(40)] y=[random.randint(0,100) for i in range(40)] z=[a*3+b*2+1 for a,b in zip(x,y)] r=map(list,zip(x,y,z)) k=mat(r) re=k.T*k e,v=scipy.linalg.eigh(re,turbo=False,eigvals=(0,0)) #e,v=scipy.linalg.eigh(re,eigvals=(a,b)) print e print v
时间: 2024-11-08 21:44:41