Info

此问题已关闭。 请重新打开它进行编辑或回答。

i am trying to execute the problem code but i am getting error in this line "Linedata(​​n1+k,:)=C​a​ndidate(​sw​1(k),:)​;"

1 次查看(过去 30 天)
i am trying to execute this problem code but i am getting error in it.
function f=bench_func(x)
[ps,d]=size(x);
%Transmission Network Expansion Planning
% Maximum and minimum bound of the population that to be generated is 1 and 16.
sw=ceil(x);
data6Bus;
n1=length(Linedata(:,1));
sw1=sw;
for k=1:length(sw1)
Linedata(n1+k,:)=Candidate(sw1(k),:);
end
n_orginalLine=n1;
n=length(Pgen);
B=zeros(n,n);
Nline=length(Linedata(:,1));
%Ncand=max(Candidate(:,1));
Xline=Linedata(:,4);
pijmax=Linedata(:,6);
Tap=ones(n);
for C=1:Nline
bline(C)=1/Xline(C);
k=Linedata(C,2);
m=Linedata(C,3);
B(k,m)=B(k,m)-(bline(C));
B(m,k)=B(k,m);
B(k,k)=B(k,k)+(bline(C));
B(m,m)=B(m,m)+(bline(C));
end
B(1,1)=10000000;
X=inv(B);
delP= Pgen-Pload;
delP=(delP');
delta=X*(delP);
pij=zeros(Nline,1);
for k=1:Nline
i=Linedata(k,2);
j=Linedata(k,3);
pij(k)=(delta(i)-delta(j))/Xline(k);
end
PIPbase=0.0;
f=sum(Linedata(n_orginalLine+1:end,7))+30;
pen=0;
for i=1:length(Linedata(:,1))
pen=pen+5000*max((abs(pij(i))-Linedata(i,6)),0);
end
for i=1:length(Candidate(:,1))
[a ]=find(sw==i);
if length(a)>3
pen=pen+1000;
end
end
f=f+pen;
error
Attempted to access Candidate(-5,:); index must be a positive integer or logical.
Error in algorithm>bench_func (line 112)
Linedata(n1+k,:)=Candidate(sw1(k),:);
Error in algorithm (line 60)
Fnew=bench_func(S(i,:));
please help me to solve this error.
  3 个评论
Muhammad Umer
Muhammad Umer 2015-9-1
the inputs are........
d=7; Ub=15; Lb=0;
i think so bcz the candidate value must be lesser or equal to Ub on every execution it shows greater then Ub or in negative integer.

回答(0 个)

此问题已关闭。

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by