function [sys,x0,str,ts,simStateCompliance] = Hebb_z(t,x,u,flag,ni,np,nd,K)
switch flag
case 0
[sys,x0,str,ts,simStateCompliance]=mdlInitializeSizes;
case 2
sys=mdlUpdate(t,x,u,ni,np,nd);
case 3
sys=mdlOutputs(t,x,u,K);
case {1,4,9}
sys=[];
otherwise
DAStudio.error('Simulink:blocks:unhandledFlag', num2str(flag));
end
function [sys,x0,str,ts,simStateCompliance]=mdlInitializeSizes
sizes = simsizes;
sizes.NumContStates = 0;
sizes.NumDiscStates = 3;
sizes.NumOutputs = 4;
sizes.NumInputs = 5;
sizes.DirFeedthrough = 1;
sizes.NumSampleTimes = 1;
sys = simsizes(sizes);
x0 = [0.1,0.1,0.1];
str = [];
ts = [0.001 0];
simStateCompliance = 'UnknownSimState';
function sys=mdlUpdate(t,x,u,ni,np,nd)
sys = x+[ni*u(1)*u(5)*u(1);np*u(1)*u(5)*(u(1)-u(2));nd*u(1)*u(5)*(u(3)-2*u(2))];
function sys=mdlOutputs(t,x,u,K)
xx = [u(1) u(1)-u(2) u(1)+u(3)-2*u(2)];
sys = [u(4)+K*xx*x/sum(abs(x));K*x/sum(abs(x))];
A05-105
标签:ni,simulink,sizes,nd,PID,ts,sys,神经网络,np From: https://blog.51cto.com/u_15815923/5744380