文件名称:1234435
介绍说明--下载内容均来自于网络,请自行研究使用
用matlab 7.0编写的滑模变结构仿真的例子。-S-function for continuous state equation
function [sys,x0,str,ts]=s_function(t,x,u,flag)
switch flag,
Initialization
case 0,
[sys,x0,str,ts]=mdlInitializeSizes
Outputs
case 3,
sys=mdlOutputs(t,x,u)
Unhandled flags
case {2, 4, 9 }
sys = []
Unexpected flags
otherwise
error([ Unhandled flag = ,num2str(flag)])
end
mdlInitializeSizes
function [sys,x0,str,ts]=mdlInitializeSizes
sizes = simsizes
sizes.NumContStates = 0
sizes.NumDiscStates = 0
sizes.NumOutputs = 3
sizes.NumInputs = 1
sizes.DirFeedthrough = 1
sizes.NumSampleTimes = 0
sys=simsizes(sizes)
x0=[]
str=[]
ts=[]
function sys=mdlOutputs(t,x,u)
x11d=sin(pi*t/2)
x21d=cos(pi*t)
x31d=1
sys(1)=x11d
sys(2)=x21d
sys(3)=x31d
function [sys,x0,str,ts]=s_function(t,x,u,flag)
switch flag,
Initialization
case 0,
[sys,x0,str,ts]=mdlInitializeSizes
Outputs
case 3,
sys=mdlOutputs(t,x,u)
Unhandled flags
case {2, 4, 9 }
sys = []
Unexpected flags
otherwise
error([ Unhandled flag = ,num2str(flag)])
end
mdlInitializeSizes
function [sys,x0,str,ts]=mdlInitializeSizes
sizes = simsizes
sizes.NumContStates = 0
sizes.NumDiscStates = 0
sizes.NumOutputs = 3
sizes.NumInputs = 1
sizes.DirFeedthrough = 1
sizes.NumSampleTimes = 0
sys=simsizes(sizes)
x0=[]
str=[]
ts=[]
function sys=mdlOutputs(t,x,u)
x11d=sin(pi*t/2)
x21d=cos(pi*t)
x31d=1
sys(1)=x11d
sys(2)=x21d
sys(3)=x31d
(系统自动生成,下载前可以参看下载内容)
下载文件列表
1234435.doc