出错
??? Undefined function or method 'PathLength' for input arguments of type 'double'.Error in ==> Metropolis at 10
R1=PathLength(D,S1);
这是出现的错误。
代码:function =Metropolis(S1,S2,D,T)
S1=;
S2=;
D=[ 0 116.8118 144.0139 35.3836 146.6322
116.8118 0 177.7104 151.7267 263.4274
144.0139 177.7104 0 157.1751 211.6814
35.3836 151.7267 157.1751 0 112.2542
146.6322 263.4274 211.6814 112.2542 0];
T=1000;
R1=PathLength(D,S1);
N=length(S1);
R2=PathLength(D,S2);
dC=R2-R1;
if dC<0
S=S2;
R=R2;
elseif exp(-dC/T)>=rand
S=S2;
R=R2;
else
S=S1;
R=R1;
end 我help 了一下
没有发现有PathLength这个函数
这个函数是你自己编的吧~~ 嗯嗯。。。。。
页:
[1]