该楼层疑似违规已被系统折叠 隐藏此楼查看此楼
function [sys,x0,str,ts] = A4(t,x,u,flag,init)
switch flag,
%%%%%%%%%%%%%%%%%%
% Initialization %
%%%%%%%%%%%%%%%%%%
case 0,
[sys,x0,str,ts] = mdlInitializeSizes(init);
case 1,
sys=mdlDerivatives(t,x,u);
%%%%%%%%%%
% Update %
%%%%%%%%%%
case 2,
sys = mdlUpdate(t,x,u);
%%%%%%%%%%
% Output %
%%%%%%%%%%
case 3,
sys = mdlOutputs(t,x,u);
case 4,
sys=mdlGetTimeOfNextVarHit(t,x,u);
%%%%%%%%%%%%%
% Terminate %
%%%%%%%%%%%%%
case 9,
sys = []; % do nothing
%%%%%%%%%%%%%%%%%%%%
% Unexpected flags %
%%%%%%%%%%%%%%%%%%%%
otherwise
error(['unhandled flag = ',num2str(flag)]);
end
function [sys,x0,str,ts] = mdlInitializeSizes(init)
sizes = simsizes;
sizes.NumContStates = 1;
sizes.NumDiscStates = 0;
sizes.NumOutputs = 1;
sizes.NumInputs = 1;
sizes.DirFeedthrough = 0;
sizes.NumSampleTimes = 1;
sys = simsizes(sizes);
x0 = [init];
str = [];
ts = [0 0];
function sys=mdlDerivatives(t,x,u)
dx=[0 1 0;0 0 1;-6 -11 -6]*x+[0;0;1]*u;
sys = dx;
function sys = mdlUpdate(t,x,u)
sys = [];
function sys = mdlOutputs(t,x,u)
sys = x;
请求大佬帮忙 怎么改 出现矩阵维度不一致