load('CSTR1_sim0.mat')

sim.t = (1:3600)./60;
figure(15)
% clf
subplot(321)
hold all
plot(sim.t,sim.y(1,:),'--','linewidth',0.5)
plot(sim.t,0.5.*ones(size(sim.y(1,:))),'k:')
ylabel ('$C_A$','Interpreter','Latex')
axs = gca;
axs.TickLabelInterpreter = 'latex';
xlim([0,60])
box on

subplot(323)
hold all
plot(sim.t,sim.y(3,:),'--','linewidth',0.5)
plot(sim.t,425.*ones(size(sim.y(3,:))),'k:')
ylabel ('$T$','Interpreter','Latex')
axs = gca;
axs.TickLabelInterpreter = 'latex';
xlim([0,60])
box on

subplot(324)
hold all
plot(sim.t,sim.u(1,:),'--','linewidth',0.5,'color',[0.64,0.08,0.18])
ylabel ('$T_{i}$','Interpreter','Latex')
axs = gca;
axs.TickLabelInterpreter = 'latex';
xlim([0,60])
box on

subplot(322)
hold all
plot(sim.t,sim.u(2,:),'--','linewidth',0.5,'color',[0.64,0.08,0.18])
plot(sim.t,ones(size(sim.y(3,:))),'k:')
ylabel ('$F$','Interpreter','Latex')
axs = gca;
axs.TickLabelInterpreter = 'latex';
xlim([0,60])
ylim([0.6,1.1])
box on

subplot(325)
hold all
plot(sim.t,sim.Ju(1,:),'--','linewidth',0.5)
plot(sim.t,0.*ones(size(sim.y(1,:))),'k:')
ylabel ('$\nabla_{T_i}J$','Interpreter','Latex')
xlabel('time [min]','Interpreter','latex')
axs = gca;
axs.TickLabelInterpreter = 'latex';
xlim([0,60])
box on

%%

load('CSTR1_sim.mat')

sim.t = (1:3600)./60;

subplot(321)
hold all
plot(sim.t,sim.y(1,:),'linewidth',1.5)
plot(sim.t,0.5.*ones(size(sim.y(1,:))),'k:')
ylabel ('$C_A$','Interpreter','Latex')
axs = gca;
axs.TickLabelInterpreter = 'latex';
xlim([0,60])
box on

subplot(323)
hold all
plot(sim.t,sim.y(3,:),'linewidth',1.5)
plot(sim.t,425.*ones(size(sim.y(3,:))),'k:')
ylabel ('$T$','Interpreter','Latex')
axs = gca;
axs.TickLabelInterpreter = 'latex';
xlim([0,60])
box on

subplot(324)
hold all
plot(sim.t,sim.u(1,:),'linewidth',1.5,'color',[0.64,0.08,0.18])
ylabel ('$T_{i}$','Interpreter','Latex')
axs = gca;
axs.TickLabelInterpreter = 'latex';
xlim([0,60])
box on

subplot(322)
hold all
plot(sim.t,sim.u(2,:),'linewidth',1.5,'color',[0.64,0.08,0.18])
plot(sim.t,ones(size(sim.y(3,:))),'k:')
ylabel ('$F$','Interpreter','Latex')
axs = gca;
axs.TickLabelInterpreter = 'latex';
xlim([0,60])
ylim([0.6,1.1])
box on

subplot(325)
hold all
plot(sim.t,sim.Ju(1,:),'linewidth',1.5)
plot(sim.t,0.*ones(size(sim.y(1,:))),'k:')
ylabel ('$\nabla_{T_i}J$','Interpreter','Latex')
xlabel('time [min]','Interpreter','latex')
axs = gca;
axs.TickLabelInterpreter = 'latex';
xlim([0,60])
box on

subplot(326)
hold all
plot(sim.t,sim.d(1,:),'k','linewidth',1.5)
ylabel ('$C_{A_i}$','Interpreter','Latex')
xlabel('time [min]','Interpreter','latex')
axs = gca;
axs.TickLabelInterpreter = 'latex';
xlim([0,60])
box on


