|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?我要加入
x
clear all
close all
Ts=0.2;
num1=[0 -0.0116 0.0193 0.0015];
den1=[1.0000 -1.6175 0.6273 0.0000];
%num1=[0 -0.0251 0.03000 0.0026];
%den1=[1.0000 -1.6294 0.6405 0.0000 ];
%num1=[0 -0.0233 0.025 0.0024];
%den1=[1.0000 -1.6653 0.6764 -0.0000];
e=zeros(1,10);
u=zeros(1,10);
y=zeros(1,10);
x=zeros(1,3);
e1=zeros(1,10);
K=zeros(1,10);
w=[0.5,0.5,0.5];
r=1;
d=100;
k2=2.5;
ke=100;
kec=300;
kc=0.01;
kuf=0.1;
ks=0.002;
b1=0.8;
b2=0.15;
K_0=0;
for t=1:1:250;
time(t)=t*Ts;
e(1)=r-y(1);
e1(1)=e(1)-e(2);
E=round(ke*e(1));
Ec=round(kec*e1(1));
uf=kuf*round(b1*E+(1-b1)*Ec);
k3=ks*round(b2*E+(1-b2)*Ec);
x(1)=r;
x(2)=k2*e(1);
x(3)=x(2)+k3*e(1);
K(1)=K_0+kc*uf;
for i=1:1:10
K(i+1)=K(i)+kc*uf;
end
ss=0;
for i=1:1:3
ss=ss+(w(i));%w(1)+w(2)+w(3)
end
if ss==0;
ss=0.01;
end
kk=0;
for i=1:1:3
kk=kk+(w(i))*x(i);%w(1)x(1)+w(2)x(2)+w(3)x (3)
end
u(1)=K(1)*kk/ss;
u(2)=K(2)*kk/ss;
u(3)=K(3)*kk/ss;
u(4)=K(4)*kk/ss;
y(1)=-den1(2)*y(2)-den1(3)*y(3)+num1(2)*u(2)+num1(3)*u(3)+num1(4)*u(4);
for j=1:1:3
w(j)=w(j)+d*(r-y(1))*u(j)*x(1);
end
for z=10:-1:2
u(z)=u(z-1);
y(z)=y(z-1);
e1(z)=e1(z-1);
e(z)=e(z-1);
% K(z)=K(z-1);
end
yout(t)=y(1);
end
figure(1)
plot(time,yout,'r' );
grid on;
这个程序为什么输出的图形纵坐标那么小。我的输入是1.输出响应应该趋于1啊,是输出函数 y(1)那儿有错误吗?请高手给于帮助 ,谢谢。
[ 本帖最后由 eight 于 2007-7-26 16:38 编辑 ] |
|