回复: 解四元二次方程组
			 
			 
			
		
		
		
			
			首先,编写一个不动点迭代法的求解程序。不动点解法比较简单,同样还有牛顿法,下山法。。。不一一类举了。 
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函数就是你需要求解的方程组。
		 
		
		
		
		
		
		
		
	 |