How do I solve for a variable?
6 views (last 30 days)
Show older comments
I am trying to solve for a variable, and I'm pretty sure I have the code written correctly but for some reason it doesn't like it. I wrote:
syms x
eqn = 2943*log((2943*x-1)/(2943*0.2*x)) + 2305.35*log((2305.35*x-1)/(2305.35*0.3*x)) == 6.2;
solve(eqn,x)
but it gives me this response in the command window:
Warning: Possibly spurious solutions. [solvelib::checkSolutions]
ans =
RootOf(some infinitely long number)
Any ideas?
0 Comments
Answers (1)
Walter Roberson
on 9 Feb 2016
Does the first 2305.35 mean 230535/100, or does it mean 230535/100 +/- 5/1000 ? Does the second 2305.35 mean the same structure as the first? If so then in the +/- case could the second 2305.35 be towards the top end of the 230535/100 + 5/1000 range but the first one be near the bottom of the 230535/100 - 5/1000 range?
Is the 0.2 the same thing as 1/5 or does it mean 1/5 +/- 5/100 or does it mean 1/5 +- 2^(-55) (the normal MATLAB interpretation) ?
Basically, if you have a floating point number in your equation, you should not be using solve() because solve() is for exact algebraic solutions, and exact algebraic solutions are GIGO (Garbage In, Garbage Out) when the inputs are imprecise. In such cases you should use vpasolve() to look for a [software] numeric solution.
When I convert the numbers as if the decimal places were exact numbers, the symbolic package I am using is taking a fair time to come up with a solution.
2 Comments
See Also
Categories
Find more on Logical in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!