资源简介
用RBF算法实现PID控制,程序可正常运行
代码片段和文件信息
%Adaptive PID control based on RBF Identification
clear all;
close all;
xite=0.5;
alfa=0.05;
beta=0.01;
x=[000]‘;
ci=zeros(36);
bi=10*ones(61);
w=0.10*ones(61);
h=[000000]‘;
ci_1=ci;ci_3=ci_1;ci_2=ci_1;
bi_1=bi;bi_2=bi_1;bi_3=bi_2;
w_1=w;w_2=w_1;w_3=w_1;
u_1=0;y_1=0;
xc=[000]‘;
error_1=0;error_2=0;
kp0=0.01;ki0=0.01;kd0=0.01;
kp_1=kp0;
kd_1=kd0;
ki_1=ki0;
xitekp=0.15;
xitekd=0.15;
xiteki=0.15;
ts=0.001;
for k=1:1:1000
time(k)=k*ts;
yd(k)=1.0;
y(k)=(-0.1*y_1+u_1)/(1+y_1^2); %Nonlinear plant
for j=1:1:6
h(j)=exp(-norm(x-ci(:j))^2/(2*bi(j)*bi(j)));
end
ym(k)=w‘*h;
d_w=0*w;
for j=1:1:6
d_w(j)=xite*(y(k)-ym(k))*h(j);
end
w=w_1+d_w+alfa*(w_1-w_2);
d_bi=0*bi;
for j=1:1:6
d_bi(j)=xite*(y(k)-ym(k))*w(j)*h(j)*(bi(j)^-3)*norm(x-ci(:j))^2;
end
bi=bi_1+ d_bi+alfa*(bi_1-bi_2);
for j=1:1:6
for i=1:1:3
d_ci(ij)=xite*(y(k)-ym(k))*w(j)*h(j)*(x(i)-ci(ij))*(bi(j)^-2);
end
end
ci=ci_1+d_ci+alfa*(ci_1-ci_2);
%%%%%%%%%%%%%%%%%%%%%%Jacobian%%%%%%%%%%%%%%%%%%%%%%%
yu=0;
for j=1:1:6
yu=yu+w(j)*h(j)*(-x(1)+ci(1j))/bi(j)^2;
end
dyu(k)=yu;
%%%%%%%%%%%%%%%%%%%%%%Start of Control system%%%%%%%%%%%%%%%%%%
error(k)=yd(k)-y(k);
kp(k)=kp_1+xitekp*error(k)*dyu(k)*xc(1);
kd(k)=kd_1+xitekd*error(k)*dyu(k)*xc(2);
ki(k)=ki_1+xiteki*error(k)*dyu(k)*xc(3);
if kp(k)<0
kp(k)=0;
end
if kd(k)<0
- 上一篇:遗传算法及流程说明
- 下一篇:基于MATLAB的LDPC码的仿真
评论
共有 条评论