vpasolve: numeric instability leading to wrong solutions?
4 次查看(过去 30 天)
显示 更早的评论
Hi,
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;
load('P3Pvar2.mat');
syms x1 x2 x3
F1=A*x1^2+B*x2^2-2*D(1)*x1*x2-d_bar(1)==0;
F2=B*x2^2+C*x3^2-2*D(2)*x2*x3-d_bar(2)==0;
F3=C*x3^2+A*x1^2-2*D(3)*x3*x1-d_bar(3)==0;
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?
0 个评论
回答(1 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Digital Filter Analysis 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!