solve(eqn,x) giving wrong answer
이전 댓글 표시
Hello,
I am working with some polynomials and am solving for x and unfortunately I am not getting the correct answer which is really baffling. You can run it to get the answer, but if you take both solutions and work backwards for some value of x and y they are not correct. I was wondering if maybe my use of FloatingPointOutput is the issue?
sympref('FloatingPointOutput',true)
syms x y
eqn = -1.5960e-06*x^2 + 0.0367*x - 2.0468 == y
solx = solve(eqn,x)
I plugged this same formula into symbolab.com and got the correct answer (0.00133... is truncated but I confirmed the first one is the correct answer)

Not sure what's going on here...
Thanks!
답변 (2개)
It looks the same to me. Just do the algebra.
b = -0.0367;
d = 0.000003192;
% Note that these values match what MATLAB is giving you
your_R1Coeff1 = -b/d
your_R1coeff2 = 1/d
You can check the answer.
sympref('FloatingPointOutput',true)
syms x y
eqn = -1.5960e-06*x^2 + 0.0367*x - 2.0468 == y
solx = solve(eqn,x)
simplify(subs(eqn, x, solx))
leftside = lhs(eqn)
simplify(subs(leftside, x, solx))
Looks right to me.
카테고리
도움말 센터 및 File Exchange에서 Systems of Nonlinear Equations에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!