程序错误什么意思?(在线等 谢谢)
function x=naivgauss(A,b);n=length(b); x=zeros(n,1);
for k=1:n-1
for i=k+1:n
xmult=A(i,j)/A(k,k);
for j=k+1:n
A(i,j)=A(i,j)-xmult*A(i,j);
end
b(i)=b(i)-xmult*b(k);
end
end
% back substitution
x(n)=b(n)/A(n,n);
for i=n-1:-1:1
sum=b(i);
for j=i+1:n
sum=sum-A(i,j)*x(j);
end
x(i)=sum/A(i,j);
end
>> A=;
b=;
>> naivgauss(A,b)
??? Error: File: naivgauss.m Line: 6 Column: 13
"j" previously appeared to be used as a function, conflicting with its use here as the name of a variable.
A possible cause of this error is that you forgot to initialize the
variable, or you have initialized it implicitly using load or eval.
不知道上面的程序错误什么意思?请各位大侠帮忙解释一下!!!谢了先! 原帖由 cannor 于 2006-11-17 19:51 发表
function x=naivgauss(A,b);
n=length(b); x=zeros(n,1);
for k=1:n-1
for i=k+1:n
xmult=A(i,j)/A(k,k);
for j=k+1:n
A(i,j)=A(i,j)-xmult*A(i,j);
end
...
xmult=A(i,j)/A(k,k);
这里的j是何值?
回复
这么明显的错误应该自己多注意了.提示:你的指标写错了. 哦 非常谢谢 都晕了 呵呵 谢谢了
页:
[1]