请教一个关于求解非线性方程的问题
请问用迭代的方法求解一个非线性方程,但是我的计算结果和别人的文章的计算结果,存在差异,可能会是什么原因,用什么样的方法,比如 牛顿法,割线法等等,才比较合适呢 虽然个人水平可能无法协助, 但总认为LZ说清楚具体些, 别人较易帮忙:loveliness:就是下面这个方程
function f=myfunc1(x)g1=16+4.8*i;
p2=pi^2/0.5^2;
f=[cos(x(1)*0.125)+ cos(x(2)*0.125) + cos(x(3)*0.125);
x(1)*sin((x(1))*0.125) +x(2)*sin(x(2)*0.125)+x(3)*sin(x(3)*0.125);
x(1)*(x(1)^2+p2)*sin(x(1)*0.125)/(x(1)^2+p2+g1)+ x(2)*(x(2)^2+p2)*sin(x(2)*0.125)/(x(2)^2+p2+g1)+ x(3)*(x(3)^2+p2)*sin(x(3)*0.125)/(x(3)^2+p2+g1)];
用fsolve就是解不开
例子是这样的
This example solves the system of two equations and two unknowns:Rewrite the equations in the form F(x) = 0:
Start your search for a solution at x0 = [-5 -5].
First, write a file that computes F, the values of the equations at x.
function F = myfun(x)
F = [2*x(1) - x(2) - exp(-x(1));
-x(1) + 2*x(2) - exp(-x(2))];
Save this function file as myfun.m somewhere on your MATLAB path. Next, set up the initial point and options and call fsolve:
x0 = [-5; -5]; % Make a starting guess at the solution
options=optimset('Display','iter'); % Option to display output
= fsolve(@myfun,x0,options)% Call solver
After several iterations, fsolve finds an answer:
Norm ofFirst-order Trust-region
Iteration Func-count f(x) step optimality radius
0 3 23535.6 2.29e+004 1
1 6 6001.72 1 5.75e+003 1
2 9 1573.51 1 1.47e+003 1
3 12 427.226 1 388 1
4 15 119.763 1 107 1
5 18 33.5206 1 30.8 1
6 21 8.35208 1 9.05 1
7 24 1.21394 1 2.26 1
8 27 0.016329 0.759511 0.206 2.5
9 303.51575e-006 0.111927 0.00294 2.5
10 331.64763e-0130.00169132 6.36e-007 2.5
Equation solved.
结果如下
Optimizer appears to be converging to a minimum that is not a root:
Sum of squares of the function values is > sqrt(options.TolFun).
Try again with a new starting point.
初值
4.7300
0.2119 - 7.2609i
3.0767 -24.8515i
要怎么办才好呢
[ 本帖最后由 ChaChing 于 2010-6-13 22:05 编辑 ]
请教一个关于求解非线性方程解的问题
function f=myfunc(x)x2=0.192313- 7.21727*i; x3=3.11169- 24.6207*i;
g1=16+4.8*i; Y=31.5; l=1; p2=l^2*(pi^2)/(b^2)
n31=x^2+p2+g1; n32=x2^2+p2+g1; n33=x3^2+p2+g1;
mf=[cos(x*0.125) cos(x2*0.125) cos(x3*0.125); ....
x*sin(x*0.125) x2*sin(x2*0.125) x3*sin(x3*0.125);...
x*(x^2+p2)*sin(x*0.125)/n31 x2*(x2^2+p2)*sin(x2*0.125)/n32 x3*(x3^2+p2)*sin(x3*0.125)/n33];
f=det(mf);
若x初值给5.2
newtonRaphson(func,dfunc,3.2,20,10^(-6))
请问如上的一个非线性方程,我用牛顿辛普森算法,得到结果18.1072
但是结果应为19.3032- 0.241585 *i为什么我就得不到呢
用fsolve得到的17.7500 - 0.4723i
为什么阿
[ 本帖最后由 ChaChing 于 2010-6-13 22:03 编辑 ]
页:
[1]