- Category:
- matlab
- Tags:
-
[WORD]
- File Size:
- 27kb
- Update:
- 2012-11-26
- Downloads:
- 0 Times
- Uploaded by:
- 吴丽
Description: 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
To Search:
File list (Check if you may need any files):
1234435.doc