Borrar filtros
Borrar filtros

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

1 visualización (últimos 30 días)
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
Error in bench_func (line 112)
Linedata(n1+k,:)=Candidate(sw1(k),:);
please help me to solve this code
  4 comentarios
Brendan Hamm
Brendan Hamm el 2 de Sept. de 2015
So, one of the elements of sw1 has the value of -5, implying that x must have had a negative value such that ceil(x) == -5. Either this should be an invalid input to x or you are indexing in an unanticipated manner.
Walter Roberson
Walter Roberson el 2 de Sept. de 2015
Or data6Bus is altering sw .
I make it a policy never to read minds after having been up all night, so we are going to need the source of data6Bus this time. And we are going to need to know max(x) and min(x)

Iniciar sesión para comentar.

Respuestas (0)

Categorías

Más información sobre Operating on Diagonal Matrices en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by