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

조회 수: 4 (최근 30일)
m
m 2012년 12월 25일
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
Roger Stafford
Roger Stafford 2012년 12월 26일
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

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

답변 (4개)

Walter Roberson
Walter Roberson 2012년 12월 25일
fsolve(@(x) [x(1)+x(2)-x(3); -x(2)+x(4)+x(5)....], ones(10,1))

m
m 2012년 12월 26일
편집: Andrei Bobrov 2012년 12월 26일
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 2012년 12월 26일
thank you

m
m 2012년 12월 26일
편집: m 2012년 12월 26일
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

태그

Community Treasure Hunt

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

Start Hunting!

Translated by