马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?我要加入
x
以前没有接触过simulink,问题比较弱。
我要输出的是Kt、Kq值,这个值是通过插值一些离散数值点得到的。在s-function面板里面的s-function parameters应该填什么?如果不填或者填如果填Kt、Kq,提示err getting arg counts for....。函数如下,请看看是什么问题?
function [sys,x0,str,ts]=mdlInitializeSizes
sizes = simsizes;
sizes.NumContStates = 1;
sizes.NumDiscStates = 0;
sizes.NumOutputs = 2;
sizes.NumInputs =31;
sizes.DirFeedthrough=1;
sizes.NumSampleTimes = 1;
sys=simsizes(sizes);
x0=[];
str=[];
ts=[0,0];
function sys=mdlOutputs(t,x,u,J0,Kt,Kq);
J=[u(1),u(2),u(3),u(4),u(5),u(6),u(7),u(8),u(9),u(10)];
Kt=[u(11),u(12),u(13),u(14),u(15),u(16),u(17),u(18),u(19),u(20)];
Kq=[u(21),u(22),u(23),u(24),u(25),u(26),u(27),u(28),u(29),u(30)];
%J=[0,0.1,0.2,0.3,0.4,0.5,0.6,0.7,0.8,0.9];
%Kq=[0.034,0.032,0.029,0.0255,0.022,0.018,0.0135,0.008,0.0025,-0.005];
%Kt=[0.315,0.28,0.25,0.22,0.17,0.125,0.08,0.03,-0.025,-0.008];
J0=u(31);
Kti= interpl(J,Kt,J0,'cubic');
Kqi= interpl(J,Kq,J0,'cubic');
sys(1)=Kti;
sys(2)=Kqi;
[ 本帖最后由 dongtao 于 2007-6-7 11:37 编辑 ] |