|
楼主 |
发表于 2007-5-12 21:21
|
显示全部楼层
function [sys,x0,str,ts]=area_sel(t,x,u,flag)
switch flag,
case 0,
[sys,x0,str,ts]= mdlInitializeSizes;
case 2,
sys=[];
case 3,
sys=mdlOutputs(t,x,u);
case 4,
sys=[];
case 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 = 2;
sizes.DirFeedthrough = 0;
sizes.NumSampleTimes = 1;
sys = simsizes(sizes);
x0 = [];
function sys=mdIOutputs(t,x,u)
if(u(1)>0)
if(u(2)/u(1)<1/sqrt(3)&&u(2)/u(1)>-1/sqrt(3))
sys=1;
end
if(u(2)/u(1)>1/sqrt(3))
sys=2;
end
if(u(2)/u(1)<-1/sqrt(3))
sys=6;
end
end
if(u(1)<0)
if(u(2)/u(1)<-1/sqrt(3))
sys=3;
end
if(u(2)/u(1)<1/sqrt(3)&&u(2)/u(1)>-1/sqrt(3))
sys=4;
end
if(u(2)/u(1)>1/sqrt(3))
sys=5;
end
end
if(u(1)==0)
if(u(2)>0)
sys=3;
else
sys=6;
end
end
这是我的程序,也就是上面那个帖子里面的,问题就是单独编译M文件的时候出错,现在明白是不可能通过了,但是为什么我改不了参数呢?每次点OK就报错。 |
|