%Plot the constraints
figure('Name','Constraint functions')
subplot(5,1,1),plot(dis_short,COPT_short(1,:)),title('DPsat')
subplot(5,1,2),plot(dis_short,COPT_short(2,:)),title('DTsup')
subplot(5,1,3),plot(dis_short,COPT_short(3,:)),title('DMsurge')
subplot(5,1,4),plot(dis_short,COPT_short(4,:)),title('DTmin')
subplot(5,1,5),plot(dis_short,COPT_short(5,:)),title('W-Wmax')

figure('Name','Objective function'),plot(dis_short,JOPT_short) ; %Plot the objective function

%Plot the optimization variables
figure('Name','Optimization variables')
subplot(6,1,1),plot(dis_short,XOPT_short(1,:),'b','LineWidth',2),ylim([lb(1) ub(1)]),title('Compressor inlet temperature')
subplot(6,1,2),plot(dis_short,XOPT_short(2,:),'b','LineWidth',2),ylim([lb(2) ub(2)]),title('HP MR temp at HX cold end')
subplot(6,1,3),plot(dis_short,XOPT_short(3,:),'b','LineWidth',2),ylim([lb(3) ub(3)]),title('Pressure after MR turbine')
subplot(6,1,4),plot(dis_short,XOPT_short(4,:),'b','LineWidth',2),ylim([lb(4) ub(4)]),title('Pressure before compressor')
subplot(6,1,5),plot(dis_short,60*XOPT_short(5,:),'b','LineWidth',2),ylim([60*lb(5) 60*ub(5)]),title('Compressor speed')
subplot(6,1,6),plot(dis_short,XOPT_short(6,:),'b','LineWidth',2),ylim([lb(6) ub(6)]),title('MR flow rate')

%Plot the sum of the scaled constraint values and the lagrange
%multipliers
figure('Name','Constraint plus lambda')
subplot(6,1,1),plot(dis_short,ROPT_short(1,:),'r','LineWidth',2),title('Lambda DPsat')
subplot(6,1,2),plot(dis_short,ROPT_short(2,:),'r','LineWidth',2),title('Lambda DTsup')
subplot(6,1,3),plot(dis_short,ROPT_short(3,:),'r','LineWidth',2),title('Lambda DMsurge')
subplot(6,1,4),plot(dis_short,ROPT_short(4,:),'r','LineWidth',2),title('Lambda DTmin')
subplot(6,1,5),plot(dis_short,ROPT_short(5,:),'r','LineWidth',2),title('Lambda W-Wmax')
subplot(6,1,6),plot(dis_short,ROPT_short(6,:),'r','LineWidth',2),title('Lambda Speed - Max speed')


figure('Name','Compressor stuff')
subplot(2,1,1),plot(dis_short,ETA_short)
subplot(2,1,2),plot(dis_short,ph_short)
