本帖最后由 Austin_uFe47 于 2017-6-9 09:09 编辑
程序如图
s函数为
function [sys,x0;str,ts]=ccc(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=3;
sizes.numinputs=1;
sizes.dirfeedthrough=1;
sizes.numsampletimes=1;
sys=simsizes(sizes);
x0=[0;0;0];
str=[];
ts=[0 0];
function sys=mdlderivatives(t,x,u)
global J rou0 rou1 af
Fc=0.28;