FORMATION OF Z BUS MATRIX
PROGRAM:
%disp("Formation of z
bus")
z=zeros(3,3);
z(1,1)=input('Enter the first
impedance:');
k(2,2)=input('Enter the first
impedance:');
e=input('Enter the no. of
lines:');
n=input('Enter the no. of
nodes:');
for i=2:e
Sa(i)=input('Enter the
impedance:');
end
for i=2:e
for j=1:i-1
z(i,j)=z(i-1,j);
z(j,i)=z(i,j)
end
z(i,i)=z(j,i)+Sa(i)
end
x=zeros(n-1,n-1);
for j=1:n-1
for k=1:n-1
x(j,k)=(z(j,k)-(z(j,n)*z(n,k)/z(n,n)));
end
end
y=x;
for i=1:n
for j=n:n
if(i~=n)
y(i,j)=x(i,n-1);
y(j,i)=x(i,n-1);
end
if(i==n)
y(i,j)=y(n-1,n)+Sa(e);
end
end
end
z
No comments:
Post a Comment