How to to make this matrix become input-able program commands?

Helloo i have a program to calculate Ybus matrix like this
% From To R x
zdata = [ 1 2 0.06 0.08
1 3 0.02 0.06
2 3 0.04 0.12]
[Ybus]=ybus(zdata)
while the fuction of Ybus is like this
function[Ybus] = mybus(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)./Z; %branch admittance
Ybus=zeros(nbus,nbus); % initialize Ybus to zero
for k = 1:nbr; % formation of the off diagonal elements
if nl(k) > 0 & nr(k) > 0
Ybus(nl(k),nr(k)) = Ybus(nl(k),nr(k)) - y(k);
Ybus(nr(k),nl(k)) = Ybus(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
Ybus(n,n) = Ybus(n,n) + y(k);
else, end
end
end
how to make the z data become the input able program for that function?

Answers (0)

Communities

More Answers in the  Power Electronics Control

Categories

Find more on Programming in Help Center and File Exchange

Asked:

on 1 Mar 2021

Commented:

dpb
on 1 Mar 2021

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!