picking a random solution to linear equations
Afficher commentaires plus anciens
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 commentaire
John D'Errico
le 16 Juil 2014
Modifié(e) : John D'Errico
le 16 Juil 2014
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.
Réponse acceptée
Plus de réponses (1)
2 commentaires
Alfonso Nieto-Castanon
le 17 Juil 2014
Modifié(e) : Alfonso Nieto-Castanon
le 18 Juil 2014
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
le 19 Juil 2014
Catégories
En savoir plus sur Creating and Concatenating Matrices dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
