How can I solve this equation by using "fsolve" :

5 views (last 30 days)
m
m on 25 Dec 2012
Functions = [a+b-c=0; -b+d+e=0; f+i-g=0; f+g=0; i-j=0; c=2; d=10; a=2g^2; b=f^3; i=e];
  1 Comment
Roger Stafford
Roger Stafford on 26 Dec 2012
There is a very good reason why fsolve is having difficulties with your ten equations. If the obvious substitutions are made, they can be reduced to two cubic equations in the single unknown f:
f^3 + 2*f^2 - 2 = 0
f^3 + 2*f - 10 = 0
These two equations have no roots in common. Hence your ten equations can have no solution. They are mutally incompatible.
Roger Stafford

Sign in to comment.

Answers (4)

Walter Roberson
Walter Roberson on 25 Dec 2012
fsolve(@(x) [x(1)+x(2)-x(3); -x(2)+x(4)+x(5)....], ones(10,1))

m
m on 26 Dec 2012
Edited: Andrei Bobrov on 26 Dec 2012
the output is:
>> fsolve(@(x) [x(1)+x(2)-x(3); -x(2)+x(4)+x(5); x(6)+x(8)-x(7); x(6)+x(7); x(8)-x(9); x(3)-2; x(4)-10; x(1)-2x(7)^2; x(2)-x(6)^3; x(8)-x(5)], ones(10,1))
??? fsolve(@(x) [x(1)+x(2)-x(3); -x(2)+x(4)+x(5); x(6)+x(8)-x(7); x(6)+x(7); x(8)-x(9); x(3)-2; x(4)-10; x(1)-2x(7)^2; x(2)-x(6)^3; x(8)-x(5)], ones(10,1))
|
Error: Unexpected MATLAB expression.
Can you help me this is my homework and I have to give it tomorrow

m
m on 26 Dec 2012
thank you

m
m on 26 Dec 2012
Edited: m on 26 Dec 2012
there is a mistake: >> fsolve(@(x) [x(1)+x(2)-x(3); -x(2)+x(4)+x(5); x(6)+x(8)-x(7); x(6)+x(7); x(8)-x(9); x(3)-2; x(4)-10; x(1)-2*x(7)^2; x(2)-x(6)^3; x(8)-x(5)], ones(9,1))
Warning: Trust-region-dogleg algorithm of FSOLVE cannot handle non-square systems; using Levenberg-Marquardt algorithm instead. > In fsolve at 314
No solution found.
fsolve stopped because the last step was ineffective. However, the vector of function values is not near zero, as measured by the default value of the function tolerance.
ans =
-0.3161
4.1390
2.9116
9.0718
-4.0046
1.6034
-0.5454
-3.0766
-3.0764
and also if we replace 9 with 10 the output:
>> fsolve(@(x) [x(1)+x(2)-x(3); -x(2)+x(4)+x(5); x(6)+x(8)-x(7); x(6)+x(7); x(8)-x(9); x(3)-2; x(4)-10; x(1)-2*x(7)^2; x(2)-x(6)^3; x(8)-x(5)], ones(10,1))
Solver stopped prematurely.
fsolve stopped because it exceeded the function evaluation limit, options.MaxFunEvals = 1000 (the default value).
ans =
-0.3362
4.1633
2.9138
9.0725
-3.9815
1.6063
-0.5392
-3.0588
-3.0536
1.0000
there is a mistake the numbers do not provide the equations

Tags

Community Treasure Hunt

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

Start Hunting!