[Numpy-discussion] 3d plane to point cloud fitting using SVD
Huan Liu
liuhuanjim013 at gmail.com
Wed Jan 26 12:48:48 EST 2011
Hi,
I just confirmed Stefan's answer on one of the examples in
http://www.mathworks.co.jp/matlabcentral/newsreader/view_thread/262996
matlab:
A = randn(100,2)*[2 0;3 0;-1 2]';
A = A + randn(size(A))/3;
[U,S,V] = svd(A);
X = V(:,end)
python:
from numpy import *
A = random.randn(100,2)*mat([[2,3,-1],[0,0,2]])
A = A + random.randn(100,3)/3.0
u,s,vh = linalg.linalg.svd(A)
v = vh.conj().transpose()
print v[:,-1]
It works! Thanks Peter for bringing this up and Stefan for answering!
Huan
More information about the NumPy-Discussion
mailing list