필터 지우기
필터 지우기

Solving system of 3 non-linear equations.

조회 수: 65 (최근 30일)
Tushar
Tushar 2011년 2월 13일
이동: Dyuman Joshi 2024년 4월 4일
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
YARA NABA
YARA NABA 2019년 3월 10일
이동: Dyuman Joshi 2024년 4월 4일
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 2019년 3월 10일
이동: Dyuman Joshi 2024년 4월 4일
What it is wrong with it?

댓글을 달려면 로그인하십시오.

채택된 답변

Oleg Komarov
Oleg Komarov 2011년 2월 13일
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
Adithya Valavi
Adithya Valavi 2020년 3월 24일
Plz tell me if you knew how to solve this equations
Christopher Creutzig
Christopher Creutzig 2020년 3월 25일
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.

댓글을 달려면 로그인하십시오.

추가 답변 (3개)

Pierce Brady
Pierce Brady 2011년 3월 30일
the output class will be syms, so try casting the answer to a double
class(ans)
double(ans)
class(ans)
  댓글 수: 1
Tyler Tomlinson
Tyler Tomlinson 2015년 12월 12일
That was a huge help, thank you so much

댓글을 달려면 로그인하십시오.


Pier Giorgio Petrolini
Pier Giorgio Petrolini 2020년 3월 23일
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
Stephen Ofori
Stephen Ofori 2023년 1월 13일
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.

댓글을 달려면 로그인하십시오.


Tushar
Tushar 2011년 2월 13일
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
Walter Roberson
Walter Roberson 2011년 2월 14일
Use vpa() or double() to get the number in decimal format.
Tushar
Tushar 2011년 2월 14일
Thanks Walter

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Symbolic Math Toolbox에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by