MATLAB Answers

vpasolve: numeric instability leading to wrong solutions?

15 ビュー (過去 30 日間)
Hubert Villeneuve
Hubert Villeneuve 2016 年 8 月 11 日
回答済み: Chidvi Modala 2020 年 10 月 27 日
I'm working on a real-time distance estimation program using data from successive image frames. To do so, I employ Perspective-3-Points, which boils down to solving systems of three nonlinear equations derived from the law of Cosines. I'm using vpasolve, as there are 8 sets of solutions, and while I often get the solutions I expect, I am occasionally getting erroneous values that come with the following warning:
Warning: Solution '[x1 = 50.513354258655913523642438228345, x2 = 70.834152303683331599397540128635, x3 = -3.6823353014471324108432162378347]' seems to be affected by some numeric instability. Inserting this solution into equation '(5682387108428029*x1^2)/36893488147419103232 - (2779811138476361*x1*x2)/9223372036854775808 + (1396576697819169*x2^2)/9223372036854775808 - 3837877865952747/73786976294838206464 = 0' produces the residue '0.074294366099841203751338186504608'.
I attached two sets of very similar variables, one resulting in errors and the other in expected solutions (with the right order of magnitude), to check with the code below:
clear; clc;
syms x1 x2 x3
S = vpasolve([F1,F2,F3],[x1, x2, x3]);
sol=double([S.x1 S.x2 S.x3])
Are there any suggestions as to what could be the cause behind the erroneous solutions from vpasolve and how to solve it?

回答 (1 件)

Chidvi Modala
Chidvi Modala 2020 年 10 月 27 日
Hi Hubert,
You can refer to a similar question answered here


Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by