以下S功能代码如何工作?

时间:2019-05-27 14:59:43

标签: s-function

下面的代码应该解决以下方程式: d2x / dt2 =(u + d)/ J

In mdlDerivatives why sys(1)=x(2)? Why not sys(1)=x(1)?

Does x(2) has different meanings in mdlDerivatives and mdlOutputs?

function sys=mdlDerivatives(t,x,u)
        J=2;
        dt=10*sin(2*pi*100*t);
        ut=u(1);
        sys(1)=x(2); 
        sys(2)=1/J*(ut+dt);

function sys=mdlOutputs(t,x,u)
        sys(1)=x(1);
        sys(2)=x(2);

0 个答案:

没有答案