solve three non linear power equations

17 views (last 30 days)
hitesh Mehta
hitesh Mehta on 27 Jul 2017
Edited: John D'Errico on 27 Jul 2017
I have three equations. I want to solve kindly help me.

Answers (3)

Star Strider
Star Strider on 27 Jul 2017
Try this (requires the Symbolic Math Toolbox):
syms x y z
assume(x > 0)
M = [x*10^y+z==5; x*25^y+z==4.95; x*30^y+z==4.89];
[xsol,ysol zsol] = vpasolve(M, [x,y,z], 'random',true)
There are several solutions. Experiment with starting values and different states for 'random'.

Sarah Gilmore
Sarah Gilmore on 27 Jul 2017
To solve your system of three non-linear equations, you can use the fsolve function. In one matlab function, define the following:
function F = root3d(x)
F(1) = x(1)*10^x(2) + x(3) - 5;
F(2) = x(1)*25^x(2) + x(3) - 4.95;
F(3) = x(1)*30^x(2) + x(3) - 4.89;
Note that the three equations are written in F(x) = 0 form and the three variables, x, y and z are replaced by x(1), x(2), x(3). x is a 1x3 vector in this case. Now, in a separate matlab script file write the following code:
x0 = [5 4.95 4.89];
x = fsolve(@root3d, x0)
x0 is your initial guess for the values of x, y and z fsolve uses to the solve the system. The first argument in fsolve, @root3d, is an anonymous function. The second argument, x0, is the input passed to root3d.
To learn more about anonymous functions, check out the following link to matlab's documentation:
To learn more about fsolve and look at more examples, check out this link:

John D'Errico
John D'Errico on 27 Jul 2017
Edited: John D'Errico on 27 Jul 2017
Do it mainly with pencil and paper?
x*(10^y - 25^y) = 5 - 4.95
x*(10^y - 30^y) = 5 - 4.89
Now take the ratio.
(10^y - 25^y)/(10^y - 30^y) = 0.05/0.11
Some simple algebra.
(.06/0.11)*10^y - 25^y + (0.05/0.11)*30^y == 0
You could use fzero to solve this, or use the symbolic toolbox. Plot shows two solutions.
vpasolve((.06/0.11)*10^y - 25^y + (0.05/0.11)*30^y == 0,4)
ans =
vpasolve((.06/0.11)*10^y - 25^y + (0.05/0.11)*30^y == 0)
ans =
Is the solution at zero a valid solution? Perhaps not, since that would result in a divide by zero. In fact, the original equations make y==0 obviously not a solution. You can go back and recover x and z now.
Or, better yet, divide by 10^y, which is fine, since 10^y will never be zero.
(.06/0.11) - 2.5^y + (0.05/0.11)*3^y == 0
Again, we can see that y==0 is a trivial solution, but not admissible, since that solution was generated by algebraic operations we did before.
It is homework though, so your problem to solve.

Community Treasure Hunt

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

Start Hunting!