冯提莫吧 关注:60,926贴子:1,734,325
  • 0回复贴,共1

快快matlab看看

取消只看楼主收藏回复

提示我带有下标的赋值维度不匹配,为啥
function sys=mdlOutputs(t,x,u)
persistent w w_1 w_2
gama=1.5;
alfa=0.02;
c=[-3,-1.5,0,1.5,3];
b=1.0*ones(5,1);
h=[0,0,0,0,0];
if t==0
w=rands(5,1);
w_1=w;w_2=w;
end
cc=25;
e=u(1);
de=u(2);
s=cc*e+de;
x=s;
for j=1:1:5
h(j)=exp(-norm(x-c(:,j))^2/(2*b(j)*b(j)));
end
ut=w*h;
d_w=0*w;
for j=1:1:5
d_w(j)=gama*s*h(j);
end
w=w_1+d_w+alfa*(w_1-w_2);
w_2=w_1;w_1=w;
sys(1)=ut;


IP属地:河北1楼2018-09-21 16:26回复