close all
whitebg([0 0.2 0.3])

load('Exp117_segundafaseROLL.mat');

plot(roll_ref,'c');hold on
plot(roll)
legend('Roll Requerido','Roll de la nave','Location','Best');
title('Evolución del Roll de la aeronave','FontWeight','bold','FontSize',12)
xlabel('Tiempo (s)','FontWeight','bold');
ylabel('Roll','FontWeight','bold');
grid on

figure
plot(ailerons)
title('Deflexión de los alerones en tanto por 1','FontWeight','bold','FontSize',12);
xlabel('Tiempo (s)','FontWeight','bold');
ylabel('Deflexión','FontWeight','bold');
grid on

figure
plot(roll_rate);hold on
plot([0 roll_rate.time(end)],[0.60 0.60]  ,'-','Color',[1 0.1 0.05],'Linewidth',2);hold on
plot([0 roll_rate.time(end)],[-0.60 -0.60]  ,'-','Color',[1 0.1 0.05],'Linewidth',2);hold on
title('Ratio de rotación (rad/s)','FontWeight','bold','FontSize',12);
xlabel('Tiempo (s)','FontWeight','bold');
ylabel('Deflexión','FontWeight','bold');
axis([0 roll_rate.time(end) min(roll_rate.data)-0.1 max(roll_rate.data)+0.1])
grid on



load('Exp117_inicioYAW.mat')


figure
plot(rudder)
title('Deflexión del timón en tanto por 1','FontWeight','bold','FontSize',12);
xlabel('Tiempo (s)','FontWeight','bold');
ylabel('Deflexión','FontWeight','bold');
grid on

figure
plot(yaw_rate)
title('Ratio de rotación para el yaw (rad/s)','FontWeight','bold','FontSize',12);
xlabel('Tiempo (s)','FontWeight','bold');
ylabel('Deflexión','FontWeight','bold');
grid on





load('Exp117_Guidance.mat');

figure
plot(XTRK,'y');hold on
plot([0 XTRK.time(end)],[0 0],'r-');hold on
legend('XTRK','Límite de diseño','Location','Best');
title('XTRK','FontWeight','bold','FontSize',12)
xlabel('Tiempo (s)','FontWeight','bold');
ylabel('XTRK','FontWeight','bold');
grid on


figure
plot(TRK,'y');hold on
plot(DTRK,'r-');hold on
legend('TRACK','DTRK','Location','Best');
title('TRKERR','FontWeight','bold','FontSize',12)
xlabel('Tiempo (s)','FontWeight','bold');
ylabel('TRK','FontWeight','bold');
grid on