Porblem with ode 45 solver
古いコメントを表示
hi I am trying to solve nonlinear state space int the form
xdot= Ax+R(x,u)
y= S(x,u)
i have written a function given below
function xdot = system(t,x,u)
Tab=sqrt(2/3)*[cos(x(1)) cos(x(1)-2*pi/3) cos(x(1)+2*pi/3)
-sin(x(1)) -sin(x(1)-2*pi/3) -sin(x(1)+2*pi/3)
1/sqrt(2) 1/sqrt(2) 1/sqrt(2)]
wc=2*pi*50;
L=1.35e-3;
R=.056;
C=50e-6;
Rc=.131;
Lc=0.96e-3;
P=10e3;
Q=5e3;
KpllI=5000;
KpPPL=2.1;
Kid2=460;
Kpd2=1;
Kiq2=460;
Kpq2=1;
udq= Tab*u;
A=[0 KpllI 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 -sqrt(2)*wc 0 wc*wc 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 -sqrt(2)*wc 0 wc*wc 0 0 0 0 0 0 0 0 0 0 0
0 0 -1 0 0 0 0 0 1 0 0 0 0 0 -1 0 0
0 0 0 -1 0 0 0 0 0 1 0 0 0 0 0 -1 0
0 0 0 0 0 0 0 0 -1 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 -1 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 -R/L 0 0 -1/L 0 0 0 0 0
0 0 0 0 0 0 0 0 0 -R/L 0 0 -1/L 0 0 0 0
0 0 0 0 0 0 0 0 0 0 -R/L 0 0 -1/L 0 0 0
0 0 0 0 0 0 0 0 1/C 0 0 0 0 0 -1/C 0 0
0 0 0 0 0 0 0 0 0 1/C 0 0 0 0 0 -1/C 0
0 0 0 0 0 0 0 0 0 0 1/C 0 0 0 0 0 -1/C
0 0 0 0 0 0 0 0 0 0 0 1/Lc 0 0 -Rc/Lc 0 0
0 0 0 0 0 0 0 0 0 0 0 0 1/Lc 0 0 -Rc/Lc 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -Rc/Lc];
w= KpllI*x(2)+KpPPL*udq(2);
vld=Kid2*x(7)+Kpd2*(x(3)-x(9))+udq(1)-w*L*x(10);
vlq=Kiq2*x(8)+Kpq2*(x(4)-x(10))+udq(2)-w*L*x(9);
;
R=[KpPPL*udq(2) % u(2)= voq
udq(2)
0
0
(udq(1)*P-udq(2)*Q)/((udq(2).^2)+(udq(1).^2))
(udq(1)*P+udq(2)*Q)/((udq(2).^2)+(udq(1).^2))
0
0
(vld*1/L)+w*x(10)
(vlq*1/L)-w*x(9)
0
w*x(13)
-w*x(12)
0
(-udq(1)*1/Lc)+w*x(16)
(-udq(2)*1/Lc)+w*x(15)
0];
xdot=A*x+R;
and the main file with
t=0:100e-5:5;
wc=50;
u= [240*sqrt(2)*sin(wc*t+pi/2)
240*sqrt(2)*sin(wc*t-2*pi/3+pi/2)
240*sqrt(2)*sin(wc*t+2*pi/3+pi/2)];
x0=zeros(17,1);
odeOptions = odeset('RelTol',1e-6);
[t,y] = ode45(@system,t,x0,odeOptions,u);
Tab=sqrt(2/3)*[cos(y(:,1)) cos(y(:,1)-2*pi/3) cos(y(:,1)+2*pi/3)
-sin(y(:,1)) -sin(y(:,1)-2*pi/3) -sin(y(:,1)+2*pi/3)
1/sqrt(2) 1/sqrt(2) 1/sqrt(2)];
udq= Tab*u;
The problem i am facing is that multiplication in the last line of code is giving error while in function file it gives no error but do not save the result. Kindly any body suggest me what i am doing wrong. Thanks
採用された回答
その他の回答 (0 件)
カテゴリ
ヘルプ センター および File Exchange で Startup and Shutdown についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!