picking a random solution to linear equations
이전 댓글 표시
This question is for a specific problem but should be of more general interest. I have two points known in 3D space say [a1 b1 c1] and [a2 b2 c2]. I need to pick two additional (unknown) points say [x1 y1 z1] and [x2 y2 z2] that satisfy the following three equations:
euclidean_distance([a1 b1 c1],[x1 y1 z1]) = 1 and euclidean_distance([a2 b2 c2],[x2 y2 z2]) = 1 and euclidean_distance([x1 y1 z1],[x2 y2 z2]) = 1
so I suppose three equations and six unknowns (the coordinates of the two unknown points). Here is where im at,
if ( euclidean_distance([a2 b2 c2],[a1 b1 c1]) > 3 ) there are 0 solutions. if ( euclidean_distance([a2 b2 c2],[a1 b1 c1]) = 3 ) there is one easy to find solution if ( euclidean_distance([a2 b2 c2],[a1 b1 c1]) < 3 ) there are infinite solution and I want to known one of them at random; preferably evenly picked from the solution space.
I know matlab can do this because matlab can do anything, Thanks
댓글 수: 1
John D'Errico
2014년 7월 16일
편집: John D'Errico
2014년 7월 16일
These are not linear equations at all. In fact, they are quadratic, because the points in question lie on the surfaces of spheres, and intersections thereof. As it turns out, the set representing the intersection of two spheres does lie in a plane, but it is still a circular set in that plane, so again, not truly linear.
채택된 답변
추가 답변 (1개)
댓글 수: 2
Alfonso Nieto-Castanon
2014년 7월 17일
편집: Alfonso Nieto-Castanon
2014년 7월 18일
Yes, that is very clever and perfectly valid.
The only somewhat inconvenient issue there is that you are not guaranteed to find an approximate solution within a certain tolerance of a true solution, rather you get a bound on the likelihood of this happening (and you control that bound with num_test_points). Depending on your application you might want to repeat your procedure until min(min(distances)) is below a predefined threshold, and that should give you a more meaningful way to control the accuracy/tolerance of the resulting solutions.
Another alternative would be to, instead of generating your S1 and S2 points randomly, use a predefined resolution-level triangulation of the sphere surface (e.g. icosahedral partitioning) which would naturally place a hard bound on the tolerance of your resulting approximate solutions.
Just some random thoughts, very interesting question by the way! (just curious, where does this problem arise / come from?)
Igor
2014년 7월 19일
카테고리
도움말 센터 및 File Exchange에서 Creating and Concatenating Matrices에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
