Please note, this is a STATIC archive of website www.tutorialspoint.com from 11 May 2019, cach3.com does not collect or store any user information, there is no "phishing" involved.
Tutorialspoint

Execute MATLAB/Octave Online

%  From To R  X
z= [0   1  0 1.0
    0   2  0 0.8
    1   2  0 0.4
    1   3  0 0.2
    2   3  0 0.2
    3   4  0 0.08];
    
    function[Y] = ybus1(zdata) 
nl=zdata(:,1); nr=zdata(:,2); R=zdata(:,3); X=zdata(:,4);
nbr=length(zdata(:,1)); nbus  =  max(max(nl), max(nr));
Z  =  R  + j*X; %branch impedance 

y= ones(nbr,1)./Zi %branch admittance
Y = zeros(nbus,nbus); % initialize Y to zero 
for k  = 1:nbr; % formation of the off diagonal elements  
if nl(k) > 0  & nr(k) > 0
Y(nl(k),nr(k)) = Y(nl(k),nr(k)) -y(k); 
Y(nr(k),nl(k)) = Y(nl(k),nr(k));
end
end
for n = 1:nbus % formation of the diagonal elements 
for k= 1:nbr
 if nl(k) == n  | nr(k) == n 
Y(n,n) = Y(n,n) + y(k); 
else, end 
end
end
    
    Y = ybus1(z)   % bus admittance matrix 
    Ibus = [-j*1.1; -j*1.25; 0;0]; 
    Zbus = inv(y)
    Vbus = Zbus * Ibus
    
    
    

Advertisements
Loading...

We use cookies to provide and improve our services. By using our site, you consent to our Cookies Policy.