错误使用 vertcat 要串联的数组的维度不一致。
16 ビュー (過去 30 日間)
古いコメントを表示
clear
clc
V0=1.02;
ZL01=0.01;
ZL12=0.03+i*0.01;
ZL23=0.05+i*0.01;
SG2=0.01;
Sload3=0.8-i*0.01;
YL01=1/ZL01;
YL12=1/ZL12;
YL23=1/ZL23;
Yload1=0.1-i*0.03;
PG2=real(SG2);
Pload3=real(Sload3);
Qload3=imag(Sload3);
Y=[YL01,-YL01,0,0;
-YL01,YL01+YL12+Yload1,-YL12,0;
0,-YL12,YL12+YL23,-YL23;
0,0,-YL23,YL23];
G01=real(Y(1,2));
B01=imag(Y(1,2));
G11=real(Y(2,2));
B11=imag(Y(2,2));
G12=real(Y(2,3));
B12=imag(Y(2,3));
G22=real(Y(3,3));
B22=imag(Y(3,3));
G23=real(Y(3,4));
B23=imag(Y(3,4));
G33=real(Y(4,4));
B33=imag(Y(4,4));
f=@(V1,V2,V3,theta1,theta2,theta3)[V1*V0*(G01*cos(theta1)+B01*sin(theta1))+V1*V1*G11+V1*V2*(G12*cos(theta1-theta2)+B12*sin(theta1-theta2));
V2*V1*(G12*cos(theta2-theta1)+B12*sin(theta2-theta1))+V2*V2*G22+V2*V3*(G23*cos(theta2-theta3)+B23*sin(theta2-theta3))-PG2;
V3*V2*(G23*cos(theta3-theta2)+B23*sin(theta3-theta2))+V3*V3*G33+Pload3;
V1*V0*(G01*sin(theta1)-B01*cos(theta1))-V1*V1*B11+V1*V2*(G12*sin(theta1-theta2)-B12*cos(theta1-theta2));
V2*V1*(G12*sin(theta2-theta1)-B12*cos(theta2-theta1))-V2*V2*B22+V2*V3*(G23*sin(theta2-theta3)-B23*cos(theta2-theta3));
V3*V2*(G23*sin(theta3-theta2)-B23*cos(theta3-theta2)) -V3*V3*B33+Qload3];
fp=@(x) f(x(1),x(2),x(3),x(4), x(5), x(6));
[x, fval, info] = fsolve (fp, [1.02;1.02;1.02;0;0;0]);
disp(x);
这个代码运行后一直报错:
错误使用 vertcat
要串联的数组的维度不一致。
出错
@(V1,V2,V3,theta1,theta2,theta3)[V1*V0*(G01*cos(theta1)+B01*sin(theta1))+V1*V1*G11+V1*V2*(G12*cos(theta1-theta2)+B12*sin(theta1-theta2));V2*V1*(G12*cos(theta2-theta1)+B12*sin(theta2-theta1))+V2*V2*G22+V2*V3*(G23*cos(theta2-theta3)+B23*sin(theta2-theta3))-PG2;V3*V2*(G23*cos(theta3-theta2)+B23*sin(theta3-theta2))+V3*V3*G33+Pload3;V1*V0*(G01*sin(theta1)-B01*cos(theta1))-V1*V1*B11+V1*V2*(G12*sin(theta1-theta2)-B12*cos(theta1-theta2));V2*V1*(G12*sin(theta2-theta1)-B12*cos(theta2-theta1))-V2*V2*B22+V2*V3*(G23*sin(theta2-theta3)-B23*cos(theta2-theta3));V3*V2*(G23*sin(theta3-theta2)-B23*cos(theta3-theta2)),-V3*V3*B33+Qload3]
出错 @(x)f(x(1),x(2),x(3),x(4),x(5),x(6))
出错 fsolve (line 255)
fuser = feval(funfcn{3},x,varargin{:});
原因:
Failure in initial objective function evaluation. FSOLVE cannot continue.
有没有大佬帮忙看看是哪里有问题,实在检查不出来了
0 件のコメント
採用された回答
jifocom
2023 年 4 月 4 日
48行标红处的减号,前面不要加空格
V3*V2*(G23*sin(theta3-theta2)-B23*cos(theta3-theta2)) -V3*V3*B33+Qload3
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Introduction to Installation and Licensing についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!