Labfans是一个针对大学生、工程师和科研工作者的技术社区。 | 论坛首页 | 联系我们(Contact Us) |
![]() |
![]() |
#2 |
高级会员
注册日期: 2008-11-07
住址: 湖南长沙
帖子: 233
声望力: 21 ![]() |
![]()
首先,编写一个不动点迭代法的求解程序。不动点解法比较简单,同样还有牛顿法,下山法。。。不一一类举了。
function [r,n]=stablepoint(x0,eps) % 初始迭代点x0 % 迭代精度 eps % 解 r % 迭代步数 n if nargin==1 eps=1.0e-4; end r=fun(x0); n=1; tol=1; while tol>eps x0=r; r=fun(x0); tol=norm(r-x0); n=n+1; if(n>100000) disp('sum of steps is too much !'); return; end end 其中fun函数就是你需要求解的方程组。 |
![]() |
![]() |