% Iterative learning control for mobile robot path - tracking
clear all;
close all;
Ts=0.001; % Sample time
For k=1:1:20 01
Xd (k)=cos ((k - 1) * PI * ts);
Yd (k)=sin ((k - 1) * PI * ts);
THD (k)=ts * PI * (k - 1) + PI/2;
End
For k=1:1:20 01
U1 (k)=0. U2 (k)=0.
E1 (k)=0. E2 (k)=0;
E3 (k)=0.
End
Y0=(1, 0, PI/2);
% % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % %
M=300;
For I=1-0: M % Start Learning Control for M Times
I
Pause (0.05);
% % % % % % % % % % % % % % % % % % % % % % % % % % % %
For k=1:1:20 01
If k==1
Q=y0;
End
Xp (k)=q (1);
Yp (k)=q (2);
Th (k)=q (3);
Qd=[xd (k), yd (k), THD (k)];
Ce1 qd (1) - (k)=q (1); % the Current error of time k
Ce2 qd (2) - (k)=q (2);
Ce3 qd (3) - (k)=q (3);
U=[u1 (k), u2 (k)];
B=[cos ts * (q (3) 0
Sin (q (3) 0
0, 1];
L1=0.10 * [cos (q (3) sin (q (3) 0;
0, 0, 1];
L2=L1;
B1=0.02; B2=0.03; % data loss
K1=L1; K2=L2 * * b1 b2 - L1;
Cond=norm ((eye (3) + B * K2) ^ (1) * (eye (3) - B * K1)); % the Conditions: cond must be smaller than 1.0
U=U + K1 * [ce1 (k + 1); the ce2 (k + 1); the ce3 (k + 1)] + K2 x [ce1 (k); ce2 (k); ce3 (k)];
U1 (k)=U (1);
U2 (k)=U (2);
U=[u1 (k), u2 (k)];
Q=q + B * u;
End % end of k
Figure (1);
hold on;
The plot (xd, yd, 'r', xp, yp, 'b');
Xlabel (' xd xp); Ylabel (' yd, yp);
J=I + 1;
Times (j)=j - 1;
E1i (j)=Max (abs (ce1));
E2i (j)=Max (abs (ce2));
E3i (j)=Max (abs (ce3));
End % end of I
Figure (2);
The plot (xd, yd, 'r', xp, yp, 'b');
Xlabel (' xd xp); Ylabel (' yd, yp);
Figure (3);
-r plot (times, e1i, '*', times, e2i, 'o - b, times, e3i,' o - k);
Title (' Change of maximum absolute value of e1 and e2 and Angle with times I ");
Xlabel (' times'); Ylabel (' e1, e2 and Angle);
Show that Attempted to access ce1 (2); The index out of bounds because numel (ce1)=1.
The Error in==& gt; Untitled5 at 51
U=U + K1 * [ce1 (k + 1); the ce2 (k + 1); the ce3 (k + 1)] + K2 x [ce1 (k); ce2 (k); ce3 (k)]
How to change this