|
楼主 |
发表于 2008-6-26 09:03
|
显示全部楼层
哎呀,这个是我的失误,忘记附上控制对象了。我现在把控制系统的s函数发过来哈。
function [sys,x0,str,ts] = mysh(t,x,u,flag)
q1=119.38;
Cv2=10.4;
Cv3=11.79;
A1=50;
A2=50;
switch flag,
case 0
[sys,x0,str,ts] = mdlInitializeSizes;
case 1
sys=mdlDerivatives(t,x,u,q1,Cv2,Cv3,A1,A2);
case 3
sys = mdlOutputs(t,x,u);
case {2,4,9}
sys = [];
otherwise
error(['Unhandled flag = ',num2str(flag)]);
end
function [sys,x0,str,ts] = mdlInitializeSizes
sizes = simsizes;
sizes.NumContStates = 2;
sizes.NumDiscStates = 0;
sizes.NumOutputs = 1;
sizes.NumInputs = 1;
sizes.DirFeedthrough = 1;
sizes.NumSampleTimes = 1;
sys = simsizes(sizes);
x0 = [50 0];
str = [];
ts = [0 0];
function sys=mdlDerivatives(t,x,u,q1,Cv2,Cv3,A1,A2)
sys(1)=x(2);
sys(2)=(q1/(A2*x(2)+Cv3*x(1)^0.5)-A1*Cv3*x(2)/(Cv2^2*x(1)^0.5)-1)*Cv2^2/(2*A1*A2)
function sys = mdlOutputs(t,x,u)
sys = x(1); |
|