% farc_plot.m

% Plot the tracking error

figure(1);

subplot(2,1,1);
plot(x2(:,1),x2(:,2),'k:',x2(:,1),x2(:,3),'k')
axis([0 20 -1.6 1.6])
legend('x_d','x');
ylabel('x_d, x   (rad)')
xlabel('Time (sec)');
title('Tracking errors');
subplot(2,1,2);
plot(error2(:,1),error2(:,2),'k')
axis([0 20 -.002 .002])
ylabel('e  (rad)')
xlabel('Time (sec)');


% Plot the control signal and the disturbances

figure(2);

subplot(2,1,1);
plot(u2(:,1),u2(:,2),'k')
axis([0 20 -10 10]);
ylabel('u');
xlabel('Time (sec)');
subplot(2,1,2);

plot(d2(:,1),d2(:,2),'k')
axis([0 20 -50 50])
ylabel('\eta')
xlabel('Time (sec)');


% Plot the adaptation weights 

figure(3);

subplot(2,1,1);
plot(thetaf2(:,1),thetaf2(:,2:13),'k-');
axis([0 20 -200 200]);
ylabel('\theta_f')
xlabel('Time (sec)');

subplot(2,1,2);
plot(thetag2(:,1),thetag2(:,2:13),'k-');
axis([0 20 0 200]);
ylabel('\theta_g')
xlabel('Time (sec)');


