S函数错误求教
function=simpendzzy(t,x,u,flag,dampzzy,gravzzy,angzzy)
switch flag,
case 0,
=mdlInitializeSizes(angzzy);
case 1,
sys=mdlDerivatives(t,x,u,dampzzy,gravzzy);
case 2,
sys=mdlUpdate(t,x,u);
case 3,
sys=mdlOutputs(t,x,u);
case 9,
sys=mdlTerminate(t,x,u);
otherwise
error['unhandled flag=',num2str(flag)]);
end
function=mdlInitializeSizes(angzzy)
sizes=simsizes;
sizes.NumContStates=2;
sizes.NumDiscStates=0;
sizes.NumOutputs=1;
sizes.NumInputs=1;
sizes.DirFeedthrough=0;
sizes.NumSampleTimes=1;
sys = simsizes(sizes);
x0=angzzy;
str=[];
ts=;
function sys=mdlDerivatives(t,x,u,dampzzy,gravzzy)
dx(1)=-dampzzy*x(1)-gravzzy*sin(x(2))+u;
dx(2)=x(1);
sys=dx;
function sys=mdlUpdate(t,x,u);
sys=[];
function sys=mdlOutputs(t,x,u)
sys=x(2);
function sys=mdlTerminate(t,x,u)
sys=[];
提示错误 :Function definitions are not permitted at the prompt or in scripts. 我用你的程序没有错误啊 你是不是在加模块的时候没有天参数啊 谢谢了!
页:
[1]