Solving system of 3 non-linear equations.

71 visualizaciones (últimos 30 días)
Tushar
Tushar el 13 de Feb. de 2011
Movida: Dyuman Joshi el 4 de Abr. de 2024
Hello, I'm trying to solve a system of equations using matlab.
The three variables are: xo2, xo, xar
I've entered the equations in as follows:
syms xo2 xo xar
eq1 = xo2 +xo +xar = 1
eq2 = 2*xo2 +xo -4*xar = 0
eq3 = 2.063E-4*xo2 = xo^2
Then, to solve the system for the variable xo I typed:
solve('eq1', 'eq2', 'eq3', xo)
and I get this message: Warning: Explicit solution could not be found.
What am I doing wrong? I'm fairly ceratain that this system is solvable.
is it because I am using symbolic algebra? For hte problem that I am solving, I dont need a general expression for the value, I just need a number.
  2 comentarios
YARA NABA
YARA NABA el 10 de Mzo. de 2019
Movida: Dyuman Joshi el 4 de Abr. de 2024
syms x y z
eq1=exp(x)+sqrt(y)-z.^3-2
eq2=x.^2-y-z-5
eq3=x+exp(y-1)+z-7
sol=solve(eq1,eq2,eq3)
sol
how can i rewrite it
darova
darova el 10 de Mzo. de 2019
Movida: Dyuman Joshi el 4 de Abr. de 2024
What it is wrong with it?

Iniciar sesión para comentar.

Respuesta aceptada

Oleg Komarov
Oleg Komarov el 13 de Feb. de 2011
Rewrite as:
syms xo2 xo xar
eq1 = xo2 +xo +xar - 1;
eq2 = 2*xo2 +xo -4*xar;
eq3 = 2.063E-4*xo2 - xo^2;
sol = solve(eq1,eq2,eq3);
sol.xo
Oleg
  3 comentarios
Adithya Valavi
Adithya Valavi el 24 de Mzo. de 2020
Plz tell me if you knew how to solve this equations
Christopher Creutzig
Christopher Creutzig el 25 de Mzo. de 2020
Adithya Valavi, did you try vpasolve?
It's usually a good idea to post a new problem in a new question, rather than adding a comment to something related.

Iniciar sesión para comentar.

Más respuestas (3)

Pierce Brady
Pierce Brady el 30 de Mzo. de 2011
the output class will be syms, so try casting the answer to a double
class(ans)
double(ans)
class(ans)

Pier Giorgio Petrolini
Pier Giorgio Petrolini el 23 de Mzo. de 2020
I hope it can be already helpfull...
syms x y z
eq1=exp(x)+sqrt(y)-z.^3-2
eq2=x.^2-y-z-5
eq3=x+exp(y-1)+z-7
eqs = [eq1, eq2, eq3]
[x,y,z]=vpasolve(eqs,[x,y,z])
% Reported results
x = -2.8;
y = 3.33;
z = -0.48;
  1 comentario
Stephen Ofori
Stephen Ofori el 13 de En. de 2023
This is also working, but the approximations makes it unsuitable for solutions where very small errors are required. If your work require minimal error then it is better to use the solve or fsolve.

Iniciar sesión para comentar.


Tushar
Tushar el 13 de Feb. de 2011
Ah thanks, excellent.
Now the only problem is that when I use your code, matlab spits out a crazy number like this:
ans =
- 2995371679198674497313343284804110513^(1/2)/147573952589676412928 - 12685211008020935/147573952589676412928
how do I get it to something more readable.. like scientific notation or something
  2 comentarios
Walter Roberson
Walter Roberson el 14 de Feb. de 2011
Use vpa() or double() to get the number in decimal format.
Tushar
Tushar el 14 de Feb. de 2011
Thanks Walter

Iniciar sesión para comentar.

Categorías

Más información sobre Symbolic Math Toolbox en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by