请求大佬 指点下!错误如下图所示
报错的这部分的代码如下:
function [sys,x0,str,ts]=s_function2(t,x,u,flag)
switch flag,
case 0,
[sys,x0,str,ts]=mdlInitializeSizes;
case 1,
sys=mdlDerivatives(t,x,u);
case 3,
sys=mdlOutputs(t,x,u);
case {2, 4, 9 }
sys = [];
otherwise
error(['Unhandled flag = ',num2str(flag)]);
end
function [sys,x0,str,ts]=mdlInitializeSizes
sizes = simsizes;
sizes.NumContStates = 3;
sizes.NumDiscStates = 0;
sizes.NumOutputs = 2;
sizes.NumInputs = 2;
sizes.DirFeedthrough = 0;
sizes.NumSampleTimes = 0;
sys=simsizes(sizes);
x0=[0.03;0.01;2];
str=[];
ts=[];
function sys=mdlDerivatives(t,x,u)
ap=9.425;be=1700000000;cd=0.65;w=0.001;
vt=280;ps=4000000;p=9000;ctp=0.00001;
ks=0.6;mt=60;fc=270;fm=500;vs=0.05;
ut=u(1);
f=u(2);
sys(1)=x(2);
sys(2)=1/mt(-10000x(2)+apx(3)-f);
sys(3)=4be/vt(cdkswsqrt((ps-sign(x(1))x(3))/p)ut-apx(2)-ctpx(3));
function sys=mdlOutputs(t,x,u)
sys(1)=x(1);
sys(2)=x(2);