# RBF神经网络参考模型自适应MATLAB实现（分析）

Matlab笔记 专栏收录该内容
12 篇文章 5 订阅



%Model Reference Aapative RBF Control

clear all;

close all;

%%%%%%%%%%%%%初始化%%%%%%%%%%%

u_1=0;

y_1=0;

ym_1=0;

x=[0,0,0]';

c=[-3 -2 -1 0 1 2 3;

-3
-2 -1 0 1 2 3;

-3
-2 -1 0 1 2 3];

b=2;

w=rands(1,7);

xite=0.55;

alfa=0.05;

h=[0,0,0,0,0,0,0]';

c_1=c;c_2=c;

b_1=b;b_2=b;

w_1=w;w_2=w;

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

ts=0.001;

for k=1:1:3000

time(k)=k*ts;

yd(k)=0.50*sin(2*pi*k*ts);%系统输入
ym(k)=0.6*ym_1+yd(k);%参考模型输出

y(k)=(-0.1*y_1+u_1)/(1+y_1^2);  %被控对象输出

for j=1:1:7

h(j)=exp(-norm(x-c(:,j))^2/(2*b^2));%节点高斯核函数

end

u(k)=w*h;%RBF神经网络输出

ec(k)=ym(k)-y(k);%系统模型误差

dyu(k)=sign((y(k)-y_1)/(u(k)-u_1));

d_w=0*w;

for j=1:1:7

d_w(j)=xite*ec(k)*h(j)*dyu(k);%梯度下降法更新权值

end

w=w_1+d_w+alfa*(w_1-w_2);

%Return of parameters

u_1=u(k);

y_1=y(k);

ym_1=ym(k);

x(1)=yd(k);

x(2)=ec(k);

x(3)=y(k);

w_2=w_1;w_1=w;

end

figure(1);

plot(time,ym,'r',time,y,'k:','linewidth',2);

xlabel('time(s)');ylabel('ym,y');

legend('Ideal
position signal','Tracking position signal');

figure(2);

plot(time,u,'r','linewidth',2);

xlabel('time(s)');ylabel('Control
input');


03-30

02-19
11-06 4693
08-06 2万+
04-21
09-27 1万+
05-30 9万+
06-01
08-02 2万+