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?
댓글 수: 1
dpb
2021년 3월 1일
Ybus=mybus(zdata);
You misspelled the function name...
답변 (0개)
커뮤니티
더 많은 답변 보기: Power Electronics Community
카테고리
도움말 센터 및 File Exchange에서 Programming에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!