📄 sect.m
字号:
function [sys,x0,str,ts]=zon(t,x,u,flag)
%dispath the flag.the switch function controls the calls to
%s_function routines at each simulation stage.
switch flag;
case 0
sizes =simsizes;
%Loadthe sizes structure witth the initialisation informatio .
sizes.NumContStates=0;
sizes.NumDiscStates=0;
sizes.NumOutputs=1;
sizes.NumInputs=1;
sizes.DirFeedthrough=1;
sizes.NumSampleTimes=1;
%Loadthe sys vector with sizes information .
sys=simsizes(sizes);
x0=[];%no continous statse
%
str=[];%no state ordiring
%
ts=[-1 0];%inherited sample time
%end of initialisation sizes
case 3
%interval des zones
A=[-30 30];
B=[30 90];
C=[90 150];
D=[150 210];
E=[210 270];
F=[270 330];
%detection de la zones pour 1 entree u
alpha=u
%----------------------zoneA
if alpha>=A(1)& alpha<=A(2)
sys=1
%----------------------zoneB
elseif alpha>=B(1)& alpha<=B(2)
sys=2
%----------------------zoneC
elseif alpha>=C(1)& alpha<=C(2)
sys=3
%----------------------zoneD
elseif alpha>=D(1)& alpha<=D(2)
sys=4
%----------------------zoneE
elseif alpha>=E(1)& alpha<=E(2)
sys=5
%----------------------zoneF
elseif alpha>=F(1)& alpha<=F(2)
sys=6
end;
case {1,2,4,9}
sys=[];%unused flags
otherwise
error(['unhanddled flag=',num2str(flag)]);%error handling
end;%end of function timestwo
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -