主题:[原创]请高手帮帮忙哦
function pbj=fun(A)
for w=0.100000000:1e-2:2-1e-1
D=diag(diag(A));
L=-tril(A,-1);
U=-triu(A,1);
H=Inv((D-w*L))[(1-w)*D+w*U]
b=eig(H);
n=length(b);
for i=1:n-1
pbj=0;
if(abs(b(i))>pbj)
pbj=abs(b(i));
end
end
disp('relaxation factor:')
w
disp('SOR方法迭代矩阵的谱半径:')
pbj
hold on
plot(w,pbj,'r')
end
xlabel('relaxation factor \omega')
ylabel('SOR iteration matrix spectral radius')
程序调用时出错如下:
??? Undefined function or method 'fun' for input arguments of type 'double'.
请大家帮帮忙啊
for w=0.100000000:1e-2:2-1e-1
D=diag(diag(A));
L=-tril(A,-1);
U=-triu(A,1);
H=Inv((D-w*L))[(1-w)*D+w*U]
b=eig(H);
n=length(b);
for i=1:n-1
pbj=0;
if(abs(b(i))>pbj)
pbj=abs(b(i));
end
end
disp('relaxation factor:')
w
disp('SOR方法迭代矩阵的谱半径:')
pbj
hold on
plot(w,pbj,'r')
end
xlabel('relaxation factor \omega')
ylabel('SOR iteration matrix spectral radius')
程序调用时出错如下:
??? Undefined function or method 'fun' for input arguments of type 'double'.
请大家帮帮忙啊