📄 gr.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=[-pi/6 pi/6];
B=[pi/6 pi/2];
C=[pi/2 5*pi/6];
D=[5*pi/6 7*pi/6];
E=[7*pi/6 3*pi/2];
F=[3*pi/2 11*pi/6];
%detection de la zones pour 1 entree u
alpha=u
alpha=mod(alpha,2*pi)
%----------------------zoneA
if alpha>=A(1)& alpha<=A(2)
sys=1
end
%----------------------zoneB
if alpha>=B(1)& alpha<=B(2)
sys=2
end
%----------------------zoneC
if alpha>=C(1)& alpha<=C(2)
sys=3
end
%----------------------zoneD
if alpha>=D(1)& alpha<=D(2)
sys=4
end
%----------------------zoneE
if alpha>=E(1)& alpha<=E(2)
sys=5
end
%----------------------zoneF
if 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 + -