Solve for a system of equations

2 views (last 30 days)
Kwanjai Yoo
Kwanjai Yoo on 7 Jun 2019
Answered: Walter Roberson on 7 Jun 2019
Hi, I am trying to solve a system of non-linear equations for 5 variables. I applied 'solve' and expected this code would derive 5 answers but it doesn't. Only a warning message "Unable to find explicit solution" was shown.
I am a beginner of Matlab, so this question might be too easy for someone.
Here is my code.
syms c x e b k %variables
syms alpha beta delta n e_bar%parameters
eqns = [alpha*k^(alpha-1) == n/beta,...
n == beta*(1-alpha)^2*e^(-alpha)*e^alpha*k^alpha,...
n*c == beta*x,...
e^(1-alpha)*e_bar^alpha*(k+(1-alpha)*k^alpha) == b-n*e-c,...
x+n*b == (e^(1-alpha)*e_bar^alpha*(1-alpha)*k^alpha+b-n*e-c)*alpha*k^(alpha-1)]
vars = [c x e b k]
solve(eqns,vars)

Answers (2)

John D'Errico
John D'Errico on 7 Jun 2019
This is not actually a question about MATLAB.
Why would you assume that every set of complicated nonlinear equations has an explicit, analytical solution?
"Unable to find explicit solution"
It says what it means. Computers are not all powerful. They cannot solve every problem that you might pose. That only happens on TV or in the movies. And that is probably why you assume that mathematics can solve all problems.
If you have explicit values for the parameters, then you can use a nonlinear numerical solver, and hope that it can find a solution. Note that often there may be multiple solutions if any exist at all, and that numerical solver might find the wrong one, or one that you don't like. That means you will need to provide good starting values.

Walter Roberson
Walter Roberson on 7 Jun 2019
In
n == beta*(1-alpha)^2*e^(-alpha)*e^alpha*k^alpha,...
the e^(-alpha) cancels the e^alpha term provided that no infinities are infolved. This causes e to drop out of the equation, leaving the equation dependent only on k out of all the variables to be solved for. But the first equation alpha*k^(alpha-1) == n/beta is also dependent only on k out of all the variables to be solved for. Therefore you have two equations with only one unknown there, and so you cannot solve the system of 5 equations for those particular 5 variables.

Community Treasure Hunt

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

Start Hunting!