%%% plot_gs_R2007b.m
%%% GS �§Œä‚Ì”ñ�üŒ`ƒVƒ~ƒ…ƒŒ�[ƒVƒ‡ƒ“

gs_cfp

% ------------------------------------------------
K_LQ = - lqr(A_0,B_0,Q,R)

% ------------------------------------------------
for num = 10:10:50
    theta1_0 = num*pi/180;

    sim('GS_LQ_R2007b')
    figure(1); plot(t,theta1/num,'r','linewidth',2); hold on
    figure(1); plot(t,theta1_LQ/num,'g--','linewidth',2); hold on

    figure(2); plot(t,theta2/num,'r','linewidth',2); hold on
    figure(2); plot(t,theta2_LQ/num,'g--','linewidth',2); hold on
end

figure(1); hold off
xlim([0 3])
ylim([-0.6 1.35])
set(gca,'xtick',0:0.5:3)
set(gca,'ytick',-0.5:0.25:1.5)
set(gca,'fontname','arial','fontsize',20)
xlabel('time [s]','fontname','arial','fontsize',22)
ylabel('{\theta}_{1}(t)/{\theta}_{1}(0)','fontname','arial','fontsize',22)
title('arm angle','fontname','arial','fontsize',22)

figure(2); hold off;
xlim([0 3])
ylim([-0.17 0.22])
set(gca,'xtick',0:0.5:3)
set(gca,'ytick',-0.15:0.05:0.2)
set(gca,'fontname','arial','fontsize',20)
xlabel('time [s]','fontname','arial','fontsize',22)
ylabel('{\theta}_{2}(t)/{\theta}_{1}(0)','fontname','arial','fontsize',22)
title('pendulum angle','fontname','arial','fontsize',22)



