[求助]求解程序,急用!
各位高手们帮小弟求解下个程序,急用!
下面两个程序问题出在哪,总运行不了.
function y=iteratepro(x,a1,a2,a3,a4)
x1=g(x,a1,a2,a3,a4);
n=1;
while(norm(x1-x)>=1.0e-6)&(n<=100)
x=x1;
x1=g(x,a1,a2,a3,a4);n=n+1;
end
x1
k=x1(1)*a1+x1(2)*a2+x1(3)*a3+x1(4)*a4;
k
n
function y=g(x,a1,a2,a3,a4)
b=x(1)*a1+x(2)*a2+x(3)*a3+x(4)*a4;
c1=abs(b-a1);c2=abs(b-a2);c3=abs(b-a3);c4=abs(b-a4);
y(1)=(c2+c3+c4)/((c1+c2+c3+c4)*3);
y(2)=(c1+c3+c4)/((c1+c2+c3+c4)*3);
y(3)=(c1+c2+c4)/((c1+c2+c3+c4)*3);
y(4)=(c1+c2+c3)/((c1+c2+c3+c4)*3);