Professional Documents
Culture Documents
Y Bus Matrix
Y Bus Matrix
clear;
arr=zeros (n,n);
for i=1:n
for j=0:n
x=0;
if(i~=j); fprintf('Is there any element between BUS-%d and BUS-%d?\n If YES
enter 1, If NO enter 0: ', i,j ); m=input(''); if (m==1) fprintf('Okay! then Enter
impedance value between BUS-%d and BUS-%d: ', i,j ); y= input('') ; x=1/y; end; if
(m==0) x=0; end; end ;
end
end
array=zeros (n,n);
for p=1:n
for q=1:n
if(p==q)
sum=0;
for r=1:n
sum = sum + arr(p,r);
end
array(p,p)=sum;
end
if(p~=q)
array(p,q)=-arr(p,q) ;
end
end
end