MATLAB: Problem to solve an EDO

problem to solve an edo

hi, i'm tring to solve an EDO but i've got this error message : Index exceeds matrix dimensions Error in ==> f_cine at 3 f=abs(y(:,1)-y(:,2)-y(:,3))-sg0 and i don't understand.
Here this is my function describing the system: function dy=f_cine(y,t)
global C1 C2 D1 D2 Q b K n E sig0 ep
f=abs(y(1)-y(2)-y(3))-sg0
if f<0
dy(4)=0
else
dy(4)=(f/K)^n
end
dy(2)=C(1)*dy(5)-D1*y(2)*dy(4)
dy(3)=C(2)*dy(5)-D2*y(3)*dy(4)
dy(5)=sign(y(1)-y(2)-y(3))*dy(4) dy(1)=E*(ep-dy(5)) dy=dy' end
thanks for your help

Best Answer

Did you check the dimensions of sg0?