Skip to main content

Abstract

This chapter introduces adaptive Runge–Kutta–Merson method for digital RBF neural network controller design. Two examples for mechanical controls are given, including digital adaptive control for a servo system and digital adaptive control for two-link manipulators.

This is a preview of subscription content, log in via an institution to check access.

Access this chapter

Chapter
USD 29.95
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
eBook
USD 129.00
Price excludes VAT (USA)
  • Available as EPUB and PDF
  • Read on any device
  • Instant download
  • Own it forever
Softcover Book
USD 169.99
Price excludes VAT (USA)
  • Compact, lightweight edition
  • Dispatched in 3 to 5 business days
  • Free shipping worldwide - see info
Hardcover Book
USD 219.99
Price excludes VAT (USA)
  • Durable hardcover edition
  • Dispatched in 3 to 5 business days
  • Free shipping worldwide - see info

Tax calculation will be finalised at checkout

Purchases are for personal use only

Institutional subscriptions

References

  1. Hoffman JD (1992) Numerical methods for engineers and scientists. McGraw-Hill, New York

    Google Scholar 

  2. Quinney D (1985) An introduction to the numerical solution of differential equations. Wiley, New York

    Google Scholar 

Download references

Author information

Authors and Affiliations

Authors

Appendix

Appendix

9.1.1 Programs for Sect. 9.1.2

Program: chap9_1.m

clear all;

close all;

ts=0.001;  %Sampling time

x_1=0.5;

for k=1:1:10000  %dx=10*sint*x

   t(k)=k*ts;

  k1=ts*10*sin(t(k))*x_1;

  k2=ts*10*sin(t(k))*(x_1+1/3*k1);

  k3=ts*10*sin(t(k))*(x_1+1/6*k1+1/6*k2);

  k4=ts*10*sin(t(k))*(x_1+1/8*k1+3/8*k3);

  k5=ts*10*sin(t(k))*(x_1+1/2*k1-3/2*k3+2*k4);

  x(k)=x_1+1/6*(k1+4*k4+k5);

  x_1=x(k);

end

figure(1);

plot(t,x,'r','linewidth',2);

xlabel('time(s)');ylabel('x');

9.1.2 Programs for Sect. 9.2.2

Main program: chap9_2.m

%Discrete RBF control for Motor

clear all;

close all;

ts=0.001; %Sampling time

node=5; %Number of neural nets in hidden layer

gama=100;

c=0.5*[-2 -1 0 1 2;

     -2 -1 0 1 2];

b=1.5*ones(5,1);

h=zeros(node,1);

alfa=3;

kp=alfa^2;

kv=2*alfa;

q_1=0;dq_1=0;tol_1=0;

xk=[0 0];

w_1=0.1*ones(node,1);

A=[0  1;

 -kp -kv];

B=[0;1];

Q=[50 0;

  0 50];

P=lyap(A',Q);

eig(P);

k1=0.001;

for k=1:1:10000

time(k)=k*ts;

qd(k)=sin(k*ts);

dqd(k)=cos(k*ts);

ddqd(k)=-sin(k*ts);

tSpan=[0 ts];

para=tol_1;       %D/A

[t,xx]=ode45('chap9_2plant',tSpan,xk,[],para); %Plant

xk=xx(length(xx),:);  %A/D

q(k)=xk(1);

%dq(k)=xk(2);

dq(k)=(q(k)-q_1)/ts;

ddq(k)=(dq(k)-dq_1)/ts;

e(k)=q(k)-qd(k);

de(k)=dq(k)-dqd(k);

xi=[e(k);de(k)];

for i=1:1:node

  S=2;

  if S==1

  w(i,1)=w_1(i,1)+ts*(gama*h(i)*xi'*P*B+k1*gama* norm(xi)*w_1(i,1)); %Adaptive law

  elseif S==2

    k1=ts*(gama*h(i)*xi'*P*B+k1*gama*norm(xi)* w_1(i,1));

    k2=ts*(gama*h(i)*xi'*P*B+k1*gama*norm(xi)* (w_1(i,1)+1/3*k1));

    k3=ts*(gama*h(i)*xi'*P*B+k1*gama*norm(xi)* (w_1(i,1)+1/6*k1+1/6*k2));

    k4=ts*(gama*h(i)*xi'*P*B+k1*gama*norm(xi)* (w_1(i,1)+1/8*k1+3/8*k3));

    k5=ts*(gama*h(i)*xi'*P*B+k1*gama*norm(xi)* (w_1(i,1)+1/2*k1-3/2*k3+2*k4));

    w(i,1)=w_1(i,1)+1/6*(k1+4*k4+k5);

  end

end

h=zeros(5,1);

for j=1:1:5

h(j)=exp(-norm(xi-c(:,j))^2/(2*b(j)*b(j)));

end

fn(k)=w'*h;

M=10;

tol1(k)=M*(ddqd(k)-kv*de(k)-kp*e(k));

d(k)=-15*dq(k)-30*sign(dq(k));

f(k)=d(k);

F=3;

if F==1      %No compensation

  fn(k)=0;

  tol(k)=tol1(k);

elseif F==2 %Modified computed torque controller

  fn(k)=0;

  tol2(k)=-f(k);

  tol(k)=tol1(k)+tol2(k);

elseif F==3 %RBF compensated controller

  tol2(k)=-fn(k);

  tol(k)=tol1(k)+1*tol2(k);

end

q_1=q(k);

dq_1=dq(k);

w_1=w;

tol_1=tol(k);

end

figure(1);

subplot(211);

plot(time,qd,'r',time,q,'k:','linewidth',2);

xlabel('time(s)');ylabel('Position tracking');

legend('ideal position','position tracking');

subplot(212);

plot(time,dqd,'r',time,dq,'k:','linewidth',2);

xlabel('time(s)');ylabel('Speed tracking');

legend('ideal speed','speed tracking');

figure(2);

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

xlabel('time(s)'),ylabel('Control input of single link');

if F==2|F==3

  figure(3);

  plot(time,f,'r',time,fn,'k:','linewidth',2);

  xlabel('time(s)'),ylabel('f and fn');

  legend('Practical uncertainties','Estimation uncertainties');

end

Program for plant: chap9_2plant.m

function dx=Plant(t,x,flag,para)

dx=zeros(2,1);

tol=para;

M=10;

d=-15*x(2)-30*sign(x(2));

dx(1)=x(2);

dx(2)=1/M*(tol+d);

9.1.3 Programs for Sect. 9.3.2

Main program: chap9_3.m

%Discrete RBF control for two-link manipulators

clear all;

close all;

T=0.001; %Sampling time

xk=[0 0 0 0];

tol1_1=0;

tol2_1=0;

ei=0;

node=5;

c_M=[-1 -0.5 0 0.5 1;

-1 -0.5 0 0.5 1];

c_C=[-1 -0.5 0 0.5 1;

-1 -0.5 0 0.5 1;

-1 -0.5 0 0.5 1;

-1 -0.5 0 0.5 1];

c_G=[-1 -0.5 0 0.5 1;

-1 -0.5 0 0.5 1];

b=10;

W_M11_1=zeros(node,1);W_M12_1=zeros(node,1);

W_M21_1=zeros(node,1);W_M22_1=zeros(node,1);

W_C11_1=zeros(node,1);W_C12_1=zeros(node,1);

W_C21_1=zeros(node,1);W_C22_1=zeros(node,1);

W_G1_1=zeros(node,1);W_G2_1=zeros(node,1);

Hur=[5 0;0 5];

for k=1:1:5000

if mod(k,200)==1

 k

end

time(k) = k*T;

qd1(k)=sin(2*pi*k*T);

qd2(k)=sin(2*pi*k*T);

dqd1(k)=2*pi*cos(2*pi*k*T);

dqd2(k)=2*pi*cos(2*pi*k*T);

ddqd1(k)=-(2*pi)^2*sin(2*pi*k*T);

ddqd2(k)=-(2*pi)^2*sin(2*pi*k*T);

para=[tol1_1 tol2_1];    %D/A

tSpan=[0 T];

[t,xx]=ode45('chap9_3plant',tSpan,xk,[],para); %A/D speed

xk = xx(length(xx),:); %A/D position

q1(k)=xk(1);

dq1(k)=xk(2);

q2(k)=xk(3);

dq2(k)=xk(4);

q=[q1(k);q2(k)];

z=[q1(k);q2(k);dq1(k);dq2(k)];

e1(k)=qd1(k)-q1(k);

de1(k)=dqd1(k)-dq1(k);

e2(k)=qd2(k)-q2(k);

de2(k)=dqd2(k)-dq2(k);

e=[e1(k);e2(k)];

de=[de1(k);de2(k)];

r=de+Hur*e;

dqd=[dqd1(k);dqd2(k)];

dqr=dqd+Hur*e;

ddqd=[ddqd1(k);ddqd2(k)];

ddqr=ddqd+Hur*de;

for j=1:1:node

   h_M11(j)=exp(-norm(q-c_M(:,j))^2/(b^2));

   h_M21(j)=exp(-norm(q-c_M(:,j))^2/(b^2));

  h_M12(j)=exp(-norm(q-c_M(:,j))^2/(b^2));

  h_M22(j)=exp(-norm(q-c_M(:,j))^2/(b^2));

end

for j=1:1:node

  h_C11(j)=exp(-norm(z-c_C(:,j))^2/(b^2));

  h_C21(j)=exp(-norm(z-c_C(:,j))^2/(b^2));

  h_C12(j)=exp(-norm(z-c_C(:,j))^2/(b^2));

  h_C22(j)=exp(-norm(z-c_C(:,j))^2/(b^2));

end

for j=1:1:node

   h_G1(j)=exp(-norm(q-c_G(:,j))^2/(b^2));

  h_G2(j)=exp(-norm(q-c_G(:,j))^2/(b^2));

end

T_M11=5*eye(node);

T_M21=5*eye(node);

T_M12=5*eye(node);

T_M22=5*eye(node);

T_C11=10*eye(node);

T_C21=10*eye(node);

T_C12=10*eye(node);

T_C22=10*eye(node);

T_G1=5*eye(node);

T_G2=5*eye(node);

for i=1:1:node

  W_M11(i,1)=W_M11_1(i,1)+T*T_M11(i,i)*h_M11(i) *ddqr(1)*r(1);

  W_M21(i,1)=W_M21_1(i,1)+T*T_M21(i,i)*h_M21(i) *ddqr(1)*r(2);

  W_M12(i,1)=W_M12_1(i,1)+T*T_M12(i,i)*h_M12(i) *ddqr(2)*r(1);

  W_M22(i,1)=W_M22_1(i,1)+T*T_M22(i,i)*h_M22(i) *ddqr(2)*r(2);

  W_C11(i,1)=W_C11_1(i,1)+T*T_C11(i,i)*h_C11(i) *dqr(1)*r(1);

  W_C21(i,1)=W_C21_1(i,1)+T*T_C21(i,i)*h_C21(i) *dqr(1)*r(2);

  W_C12(i,1)=W_C12_1(i,1)+T*T_C12(i,i)*h_C12(i)* ddqr(2)*r(1);

  W_C22(i,1)=W_C22_1(i,1)+T*T_C22(i,i)*h_C22(i)* ddqr(2)*r(2);

  W_G1=W_G1_1+T*T_G1(i,i)*h_G1(i)*r(1);

  W_G2=W_G2_1+T*T_G2(i,i)*h_G2(i)*r(2);

end

MSNN_g=[W_M11'*h_M11' W_M12'*h_M12';

   W_M21'*h_M21' W_M22'*h_M22'];

GSNN_g=[W_G1'*h_G1';

   W_G2'*h_G2'];

CDNN_g=[W_C11'*h_C11' W_C12'*h_C12';

   W_C21'*h_C21' W_C22'*h_C22'];

tol_m=MSNN_g*ddqr+CDNN_g*dqr+GSNN_g;

Kp=[20 0;0 20];

Ki=[20 0;0 20];

Kr=[1.5 0;0 1.5];

Kp=[100 0;0 100];

Ki=[100 0;0 100];

Kr=[0.1 0;0 0.1];

ei=ei+e*T;

tol=tol_m+Kp*r+Kr*sign(r)+Ki*ei;

tol1(k)=tol(1);

tol2(k)=tol(2);

W_M11_1=W_M11;

W_M21_1=W_M21;

W_M12_1=W_M12;

W_M22_1=W_M22;

W_C11_1=W_C11;

W_C21_1=W_C21;

W_C12_1=W_C12;

W_C22_1=W_C22;

W_G1_1=W_G1;

W_G2_1=W_G2;

tol1_1=tol1(k);

tol2_1=tol2(k);

end

figure(1);

subplot(211);

plot(time,qd1,'r',time,q1,'k:','linewidth',2);

xlabel('time(s)'),ylabel('Position tracking of link 1');

legend('ideal position','position tracking');

subplot(212);

plot(time,qd2,'r',time,q2,'k:','linewidth',2);

xlabel('time(s)'),ylabel('Position tracking of link 2');

legend('ideal position','position tracking');

figure(2);

subplot(211);

plot(time,dqd1,'r',time,dq1,'k:','linewidth',2);

xlabel('time(s)'),ylabel('Speed tracking of link 1');

legend('ideal speed','speed tracking');

subplot(212);

plot(time,dqd2,'r',time,dq2,'k:','linewidth',2);

xlabel('time(s)'),ylabel('Speed tracking of link 2');

legend('ideal speed','speed tracking');

figure(3);

subplot(211);

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

xlabel('time(s)'),ylabel('Control input of link 1');

subplot(212);

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

xlabel('time(s)'),ylabel('Control input of link 2');

Program for plant: chap9_3plant.m

function dx=Plant(t,x,flag,para)

%%%%%%%%%%%%%% x(1)=q1; x(2)=dq1; x(3)=q2; x(4)=dq2; %%%%%%%%%%%%

dx=zeros(4,1);

p=[2.9 0.76 0.87 3.04 0.87];

g=9.8;

M0=[p(1)+p(2)+2*p(3)*cos(x(3)) p(2)+p(3)*cos(x(3));

p(2)+p(3)*cos(x(3)) p(2)];

C0=[-p(3)*x(4)*sin(x(3)) -p(3)*(x(2)+x(4))*sin(x(3));

p(3)*x(2)*sin(x(3)) 0];

G0=[p(4)*g*cos(x(1))+p(5)*g*cos(x(1)+x(3));

p(5)*g*cos(x(1)+x(3))];

tol=para(1:2);

dq=[x(2);x(4)];

ddq=inv(M0)*(tol'-C0*dq-G0);

%%%%%%% dx(1)=dq1; dx(2)=ddq1; dx(3)=dq2; dx(4)=ddq2; %%%%%%%%%%%%%

dx(1)=x(2);

dx(2)=ddq(1);

dx(3)=x(4);

dx(4)=ddq(2);

Rights and permissions

Reprints and permissions

Copyright information

© 2013 Tsinghua University Press, Beijing and Springer-Verlag Berlin Heidelberg

About this chapter

Cite this chapter

Liu, J. (2013). Digital RBF Neural Network Control. In: Radial Basis Function (RBF) Neural Network Control for Mechanical Systems. Springer, Berlin, Heidelberg. https://doi.org/10.1007/978-3-642-34816-7_9

Download citation

  • DOI: https://doi.org/10.1007/978-3-642-34816-7_9

  • Published:

  • Publisher Name: Springer, Berlin, Heidelberg

  • Print ISBN: 978-3-642-34815-0

  • Online ISBN: 978-3-642-34816-7

  • eBook Packages: EngineeringEngineering (R0)

Publish with us

Policies and ethics