How to troubleshoot solver when wrong variable is showing up?

1 次查看(过去 30 天)
When using solver, I am getting a variable that is not in my equation in the solution. What should I troubleshoot?
I am solving an 5 degree polynomial with t as the only variable, and instead of one answer (there should only be one), there are five answers that include a 'z' (yes,'z', that's not a typo).
  3 个评论
Suzie Oman
Suzie Oman 2017-9-11
I am using the solve command. Below are the equations where x,y and Q are functions of t.
Q = (1543*t)/100 - 3993/1000; x = (27*t)/8 - 4503607640442835/5070602400912917605986812821504; y = (3641*t)/250 - 42321/1000;
rhs = p00 + p10*x + p01*y + p20*x.^2 + p11*x.*y + p02*y.^2 + p30*x.^3 + p21*(x.^2).*y + p12*x.*y.^2 + p03*y.^3 + p40*x.^4 + p31*(x.^3).*y + p22*(x.^2).*y.^2 + p13*x.*y.^3 + p04*y.^4 + p50*x.^5 + p41*(x.^4).*y + p32*(x.^3).*y.^2 + p23*(x.^2).*y.^3 + p14*x.*y.^4 + p05*y.^5;
tsoln = solve(lhs == rhs,t)
Rik
Rik 2017-9-12
Are all those p values supposed to be syms as well? What code are you using to define your variables? A good strategy is to try to condens your problem to the smallest piece of code that reproduces the problem: a MWE (or MFE, minimal failing example). Then we can run your code and try to fix it that way (and see if we can reproduce it on our OS release combination).
(note that Q is unused and you haven't defined lhs in your comment above)

请先登录,再进行评论。

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Programming 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by