|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?我要加入
x
function [sys,x0,str,ts] = zhu(t,x,u,flag)
switch flag
case 0
[sys,x0,str,ts]=mdlInitializeSizes;
case 3
sys=mdlOutputs(t,x,u);
case {1,2,4,9}
sys=[];
otherwise
error(['Unhandled flag = ',num2str(flag)]);
end
function [sys,x0,str,ts]=mdlInitializeSizes
sizes = simsizes;
sizes.NumContStates = 0;
sizes.NumDiscStates = 0;
sizes.NumOutputs = 1;
sizes.NumInputs = 1;
sizes.DirFeedthrough = 1;
sizes.NumSampleTimes = 0; % at least one sample time is needed
sys = simsizes(sizes);
%
% initialize the initial conditions
%
x0 = [];
%
% str is always an empty matrix
%
str = [];
%
% initialize the array of sample times
%
ts = [0 0];
% end mdlInitializeSizes
%=============================================================================
% mdlOutputs
% Return the block outputs.
%=============================================================================
%
function sys=mdlOutputs(t,x,u)
sys = 0.25*pi*0.0171*8*10^6*(0.027/(0.027-0.25*pi*0.0171*u))^1.2;
% end mdlOutputs
为什么我将sizes.NumSampleTimes =1;改为sizes.NumSampleTimes = 0;就会报错Sample times (TS) matrix returned by M-File S-function 'zhu' in 'untitled/S-Function' must be empty,请各位高手指点一二
|
|