Hi everyone, Here is the code, that gives me the error that I put in my title. Please correct my code, Also, I am new in MATLAB, please advice me Thanks in advance. When i was created it, its working nicely, but, after one day i faced the above problem. my initial values are; y0=[q1 q2 q3 q4 w1 w2 w3]=[0 0 0 1 0 0 0]; t=0:0.3:50; i used ode45 to solve the following problem. Error coming from 18th line. Please fix the following problem
function xdot=controller1(t,y)
global u1 u2 u3 ue1 ue2 ue3 Ix Iy Iz q1c q2c q3c q4c Kv Kp
dy=zeros(7,1);
ue1=0;
ue2=0;
ue3=0;
Kv=370;
Kp=315;
dy(1)=((y(7)*y(2)-y(6)*y(3)+y(5)*y(4))*.5);
dy(2)=((-y(7)*y(1)+y(5)*y(3)+y(6)*y(4))*.5);
dy(3)=((y(6)*y(1)-y(5)*y(2)+y(7)*y(4))*.5);
dy(4)=((-y(5)*y(1)-y(6)*y(2)+y(7)*y(3))*.5);
dy(5)=(u1+ue1+(Iy-Iz)*y(6)*y(7))/Ix;
dy(6)=(u2+ue2+(Iz-Ix)*y(7)*y(5))/Iy;
dy(7)=(u3+ue3+(Ix-Iy)*y(5)*y(6))/Iz;
qe1=(q4c*y(1)+q3c*y(2)-q2c*y(3)-q1c*y(4));
qe2=(-q3c*y(1)+q4c*y(2)-q1c*y(3)-q2c*y(4));
qe3=(q2c*y(1)-q1c*y(2)+q4c*y(3)-q3c*y(4));
u1=-Kp*qe1-Kv*y(5);
u2=-Kp*qe2-Kv*y(6);
u3=-Kp*qe3-Kv*y(7);
xdot=[dy(1);dy(2);dy(3);dy(4);dy(5);dy(6);dy(7)];
end