0% found this document useful (0 votes)
79 views1 page

Program For Ybus

This MATLAB code calculates the bus admittance matrix (ybus) for a 3-bus system. It defines the from and to bus numbers, resistance and reactance values, calculates the admittances, initializes the ybus matrix, populates the off-diagonal elements using the admittance values, calculates the diagonal elements by summing the admittances connected to each bus, and displays the final ybus matrix.

Uploaded by

Vikash Kumar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
79 views1 page

Program For Ybus

This MATLAB code calculates the bus admittance matrix (ybus) for a 3-bus system. It defines the from and to bus numbers, resistance and reactance values, calculates the admittances, initializes the ybus matrix, populates the off-diagonal elements using the admittance values, calculates the diagonal elements by summing the admittances connected to each bus, and displays the final ybus matrix.

Uploaded by

Vikash Kumar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

24/8/17 7:55 AM G:\MATLAB\ybusassignment2.

m 1 of 1

%ybus problem number 2


clc;
clear all;
%calculation for ybus
fb=[1 1 2];
tb=[2 3 3];
r=[0.02 0.01 0.0125];
x=[0.04 0.03 0.025];
z=r+1i*x ;
y=1./z;
nbus=max(max(fb),max(tb));
nbranch=length(fb);
ybus=zeros(nbus,nbus);
% off digonal elements
for k=1:3
ybus(fb(k),tb(k))=-y(k);
ybus(tb(k),fb(k))= ybus(fb(k),tb(k));
end
% diagonal elements
for m=1:3
for n=1:3
if fb(n)== m || tb(n)== m
ybus(m,m)=ybus(m,m)+y(n);
end
end
end
ybus

You might also like