How do I solve for a variable?

4 visualizaciones (últimos 30 días)
Jason Cardillo
Jason Cardillo el 9 de Feb. de 2016
Comentada: Walter Roberson el 10 de Feb. de 2016
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?

Respuestas (1)

Walter Roberson
Walter Roberson el 9 de Feb. de 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 comentarios
Jason Cardillo
Jason Cardillo el 9 de Feb. de 2016
Yeah those are decimal points, so it should be 1/5 and I'm not sure what the 2305.35 would be as a fraction.
So if that doesn't work I don't quit understand what I need to do in order to make it work. Can you help me with that?
Walter Roberson
Walter Roberson el 10 de Feb. de 2016
Instead of using
solve(eqn,x)
use
vpasolve(eqn,x)

Iniciar sesión para comentar.

Community Treasure Hunt

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

Start Hunting!

Translated by