Undefined function 'ShortLine' for input arguments of type 'double'.

1 次查看(过去 30 天)
%***- - - - - Main Program
function test()
TransmissionLineData;
[ZSeries,YShunt] = ShortLine(nphc,ngw,nb,bsep,resis,rdext,gmr,x,y,f, sigmag,vbase,sbase)
[Z012,Y012] = SequenceImpedance(ZSeries,YShunt);
%End main Program
function [Z012,Y012] = SequenceImpedance(ZSeries,YShunt)
TS(1,1) = 1;
TS(1,2) = 1;
TS(1,3) = 1;
TS(2,1) = 1;
TS(2,2) = -0.5-sqrt(3)*0.5*i;
TS(2,3) = -0.5+sqrt(3)*0.5*i;
TS(3,1) = 1;
TS(3,2) = -0.5+sqrt(3)*0.5*i;
TS(3,3) = -0.5-sqrt(3)*0.5*i;
ST = inv(TS);
Z012 = ST*ZSeries*TS;
Y012 = ST*YShunt*TS;
  12 个评论
MOHD ABDUL MUQEEM
MOHD ABDUL MUQEEM 2017-12-15
编辑:Walter Roberson 2017-12-15
%***- - - - - Main Program
function test()
TransmissionLineData;
LongLineData;
[ZSeries,YShunt,Z012,Y012] = ShortLine(nphc,ngw,nb,bsep,resis,...
rdext,gmr,x,y,f,sigmag,vbase,sbase);
[ZPhase,YPhase] = LongLine(nphc,nsections,length,ZSeries,YShunt,...
ZSe,Ysh);
%End main Program
function [ZPhase,YPhase] = LongLine(nphc,nsect,length,ZSeries,...
YShunt,ZSe,YSh)
AUX = eye(nphc*2);
[TV,ZY] = eig(ZSeries*YShunt);
[TI,YZ] = eig(YShunt*ZSeries);
ZModal = inv(TV)*ZSeries*TI;
YModal = inv(TI)*YShunt*TV;
kk = 1;
for ll = 1: nsect
if ( length(ll) > 0 )
[ABCD] = ABCDLine(ll,nphc,length,ZModal,YModal,TV,TI);
else
[ABCD] = ABCDComp(kk,nphc,ZSe,YSh);
kk = kk + 1;
end
AUX = AUX*ABCD;
end
ABCD = AUX;
A = ABCD(1:nphc,1:nphc);
B = ABCD(1:nphc,nphc+1:nphc*2);
C = ABCD(nphc+1:nphc*2,1:nphc);
D = ABCD(nphc+1:nphc*2,nphc+1:nphc*2);
ZPhase(1:nphc,1:nphc) = A*inv(C);
ZPhase(1:nphc,nphc+1:nphc*2) = -B + A*inv(C)*D;
ZPhase(nphc+1:nphc*2,1:nphc) = inv(C);
ZPhase(nphc+1:nphc*2,nphc+1:nphc*2) = inv(C)*D;
YPhase = inv(ZPhase);
%End LongLine function
function [ABCD] = ABCDLine(ll,nphc,length,ZModal,YModal,TV,TI);
Modal = zeros(nphc,nphc);
for ii = 1: nphc
gamma = sqrt(ZModal(ii,ii)*YModal(ii,ii));
gammar = real(gamma*length(ll));
gammai = imag(gamma*length(ll));
fact1 = sinh(gammar);
fact2 = cosh(gammar);
fact3 = sin(gammai);
fact4 = cos(gammai);
Modal(ii,ii) = ((fact2*fact4)+(fact1*fact3)*i);
end
ABCD(1:nphc,1:nphc) = TV*Modal*inv(TV);
for ii = 1: nphc
gamma = sqrt(ZModal(ii,ii)*YModal(ii,ii));
gammar = real(gamma*length(ll));
gammai = imag(gamma*length(ll));
fact1 = sinh(gammar);
fact2 = cosh(gammar);
fact3 = sin(gammai);
fact4 = cos(gammai);
Modal(ii,ii) = sqrt(ZModal(ii,ii)/YModal(ii,ii))*...
(fact1*fact4+fact2*fact3*i);
end
ABCD(1:nphc,nphc+1:nphc*2) = TV*Modal*inv(TI);
for ii = 1: nphc
gamma = sqrt(ZModal(ii,ii)*YModal(ii,ii));
gammar = real(gamma*length(ll));
gammai = imag(gamma*length(ll));
fact1 = sinh(gammar);
fact2 = cosh(gammar);
fact3 = sin(gammai);
fact4 = cos(gammai);
Modal(ii,ii) = sqrt(YModal(ii,ii)/ZModal(ii,ii))*...
(fact1*fact4+fact2*fact3*i);
end
ABCD(nphc+1:nphc*2,1:nphc) = TI*Modal*inv(TV);
for ii = 1: nphc
gamma = sqrt(ZModal(ii,ii)*YModal(ii,ii));
gammar = real(gamma*length(ll));
gammai = imag(gamma*length(ll));
fact1 = sinh(gammar);
fact2 = cosh(gammar);
fact3 = sin(gammai);
fact4 = cos(gammai);
Modal(ii,ii) = (fact2*fact4+fact1*fact3*i);
end
ABCD(nphc+1:nphc*2,nphc+1:nphc*2) = TI*Modal*inv(TI);
%End ABCDLine function
function [ABCD] = ABCDComp(kk,nphc,ZSe,YSh)
One = eye(nphc) ;
ABCD(1:nphc,1:nphc) = One ;
ABCD(1:nphc,nphc+1:nphc*2) = ZSe(:,:,kk) ;
ABCD(nphc+1:nphc*2,1:nphc) = YSh(:,:,kk) ;
ABCD(nphc+1:nphc*2,nphc+1:nphc*2) = YSh(:,:,kk)*ZSe(:,:,kk) + One ;
%End ABCDComp function
Walter Roberson
Walter Roberson 2017-12-15
I am confused. You have posted several different function test(), only one of which defines function ShortLine . I do not know which one is the correct version.
If you define a function inside a .m but not as the first function in the file, then that second function cannot be called from outside the .m (unless you pass out a handle to it.)

请先登录,再进行评论。

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Tables 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by