马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?我要加入
x
在仿真过程中,出现下边的错误Error in block 'untitled2/POSITION DETECT/S-Function' while executing M-File S-function block 'pulsed', flag = 3 (output), at time 0.001079639262278552. MATLAB error message:
One or more output arguments not assigned during call to 'pulsed (mdlOutputs)'。其中s函数如下:
function [sys,x0,str,ts] = plused(t,x,u,flag)
switch flag,
case 0,
[sys,x0,str,ts]=mdlInitializeSizes;
case 1,
sys=[];
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 = 0;
sizes.NumDiscStates = 0;
sizes.NumOutputs = 6;
sizes.NumInputs = 1;
sizes.DirFeedthrough = 1;
sizes.NumSampleTimes = 1; % at least one sample time is needed
sys = simsizes(sizes);
x0 = [];
str = [];
ts = [0 0];
function sys=mdlDerivatives(t,x,u)
sys = [];
function sys=mdlUpdate(t,x,u)
sys = [];
function sys=mdlOutputs(t,x,u)
theta=u(1);
if(theta>=0&&theta<pi/3)
sys=[1,0,0,1,0,0]
elseif(theta>=pi/3&&theta<2*pi/3)
sys=[1,0,0,0,0,1]
elseif(theta>=2*pi/3&&theta<pi)
sys=[0,0,1,0,0,1]
elseif(theta>=pi&&theta<4*pi/3)
sys=[0,1,1,0,0,0]
elseif(theta>=4*pi/3&&theta<5*pi/3)
sys=[0,1,0,0,1,0]
elseif(theta>=5*pi/3&&theta<=2*pi)
sys=[0,0,0,1,1,0]
end
请高手指教 |