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)00(udq(1)*P-udq(2)*Q)/((udq(2).^2)+(udq(1).^2))(udq(1)*P+udq(2)*Q)/((udq(2).^2)+(udq(1).^2))00(vld*1/L)+w*x(10)(vlq*1/L)-w*x(9)0w*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
Best Answer