You are on page 1of 2

% Ybus formation using Sparsity Scheme-3

clear all
b=5;
l=7;
s=[1 1 2 2 2 3 4];
e=[2 3 3 4 5 4 5];
z=[0.02+0.06*i 0.08+0.24*i 0.06+0.18*i 0.06+0.18*i 0.04+0.12*i 0.01+0.03*i
0.08+0.24*i];
ysh=[0.03*i 0.025*i 0.020*i 0.020*i 0.015*i 0.010*i 0.025*i];
row(b)=0;
dia(b)=0;
col(2*l)=0;
next(2*l)=0;
f1=0;
j=0;
for i=1:l
yse(i)=1/z(i);
L=s(i);
M=e(i);
dia(L)=dia(L)+yse(i)+ysh(i);
dia(M)=dia(M)+yse(i)+ysh(i);
K=L;
N=M;
f2=0;
while f2==0;
j=j+1;
if row(K)==0;
row(K)=j;
else
L1=row(K);
f1=0;
while f1==0;
L2=next(L1);
if L2==0;
next(L1)=j;
f1=1;
else
L1=L2;
end
end
end
y(j)=-yse(i);
col(j)=N;
next(j)=0;
if K~=M;
K=M;
N=L;
else
f2=1;
end
end
end
disp(row);
disp(dia);
disp(y);
disp(col);
disp(next);
Row:
1 2 4 8 10
dia:
6.2500 -18.6950i 10.8333 -32.4150i 12.9167 -38.6950i 12.9167 -38.6950i 3.7500
-11.2100i
Y:
Columns 1 through 8

-5.0000 +15.0000i -5.0000 +15.0000i -1.2500 + 3.7500i -1.2500 + 3.7500i


-1.6667 + 5.0000i -1.6667 + 5.0000i -1.6667 + 5.0000i -1.6667 + 5.0000i

Columns 9 through 14

-2.5000 + 7.5000i -2.5000 + 7.5000i -10.0000 +30.0000i -10.0000 +30.0000i


-1.2500 + 3.7500i -1.2500 + 3.7500i

Col:
2 1 3 1 3 2 4 2 5 2 4 3 5 4
Next:
3 5 0 6 7 11 9 12 0 14 0 13 0 0

You might also like