function [sys,x0,str,ts]=fig4_3_2watch(t,x,u,flag)
switch flag,
case 0,
[sys,x0,str,ts]=mdlInit();
case 1,
sys=mdlDer(t,x,u);
case 3,
sys=mdlOutput(t,x,u);
otherwise,
sys=[];
end;
function [sys,x0,str,ts]= mdlInit()
size=simsizes;
size.NumContStates=3;
size.NumDiscStates=0;
size.NumOutputs=3;
size.NumInputs=1;
size.DirFeedthrough=0;
size.NumSampleTimes=0;
sys=simsizes(size);
x0=[0,0,0];
str=[];
ts=[];
function sys=mdlDer(t,x,u)
e=x(1)-u(1);
fe=fal(e,0.5,0.01);
fe1=fal(e,0.5,0.01);
beta1=100;
beta2=300;
beta3=1000;
sys(1)=x(2)-beta1*e;
sys(2)=x(3)-beta2*fe+3*cos(t/2);
sys(3)=-beta3*fe1;
function sys=mdlOutput(t,x,u)
sys=x;
function [sys,x0,str,ts]=fig4_3_2ctrl(t,x,u,flag)
switch flag,
case 0,
[sys,x0,str,ts]=mdlInit();
case 1,
sys=mdlDer(t,x,u);
case 3,
sys=mdlOutput(t,x,u);
otherwise,
sys=[];
end;
function [sys,x0,str,ts]= mdlInit()
size=simsizes;
size.NumContStates=2;
size.NumDiscStates=0;
size.NumOutputs=3;
size.NumInputs=0;
size.DirFeedthrough=0;
size.NumSampleTimes=0;
sys=simsizes(size);
x0=[0,0];
str=[];
ts=[];
function sys=mdlDer(t,x,u)
a=1;
w=1;
sys(1)=x(2);
sys(2)=a*sign(sin(w*t))+3*cos(t/2);
function sys=mdlOutput(t,x,u)
a=1;
w=1;
sys=x;
sys(3)=a*sign(sin(w*t));
本文来源:https://www.wddqw.com/doc/e6a93e1331b765ce04081426.html
正在阅读:
ESO01-01
培根《谈读书》教学设计01-01
最新生产车间管理者工作总结01-01
我做社区小主人01-01
赤峰学院学人风采——任爱君教授01-01
个人利益和集体利益的关系01-01
《简爱》读后感1000字(精选3篇)01-01
全民消防安全意识调查问卷01-01