s-function error
2 ビュー (過去 30 日間)
古いコメントを表示
Hello i have a problem with my s-function
i have this error after run my simulink
'smtest/S-function'while executing M-File S-function 's-function',flag=0(initialize),at start of simulation.MATLAB error message:Undefined function or variable 'mdllnitializes' this is the function
function [sys,x0,str,ts]=s_function(t,x,u,flag)
switch flag,
case 0,
[sys,x0,str,ts]=mdlInitializes;
case 1,
sys=mdlDerivatives(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=2;
sizes.NumInputs=1;
sizes.DirFeedthrough=0;
sizes.NumSampleTimes=0;
sys=simsizes(sizes);
x0=[0.5 1.0];
str=[];
ts=[];
function sys=mdlDerivatives(x,u)
J=10;
sys(1)=x(2);
sys(2)=1/J*u;
function sys=mdlOutputs(x,u,t)
sys(1)=x(1);
sys(1)=x(2);
0 件のコメント
回答 (1 件)
参考
カテゴリ
Help Center および File Exchange で Block and Blockset Authoring についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!