%Plot scaled gain G with respect to unconstrained degrees of freedom
load G

stage=1:48;                            %stages in the main column
stage1=stage(13:36);                   %stages in the prefractionator
subplot(3,1,1)
GL = G(:,1);
GLp = GL(1:24);
plot(stage1,GLp,'b','Linewidth',2.5)
xlim([1 50])
ylim([-150 0])
set(gca,'XTick',0:5:50);
set(gca,'YTick',-150:25:0);
xlabel('Stage','FontSize',12,'FontWeight','bold')
ylabel('G (L)','FontSize',12,'FontWeight','bold')
title('Scaled gain with respect to reflux, L','FontSize',12,'FontWeight','bold')
hold on
GLm=GL(25:72);
plot(stage,GLm,'r','Linewidth',2.5)
legend('Prefractionator','Main-column')
hold off

%plot scaled gain GS for side stream, S
subplot(3,1,2)
GS = G(:,2);
GSp = GS(1:24);
plot(stage1,GSp,'b','Linewidth',2.5)
xlim([1 50])
ylim([-100 200])
set(gca,'XTick',0:5:50);
set(gca,'YTick',-100:50:200);
xlabel('Stage','FontSize',12,'FontWeight','bold')
ylabel('G (S) ','FontSize',12,'FontWeight','bold')
title('Scaled gain with respect to side stream','FontSize',12,'FontWeight','bold')
hold on
GSm=GS(25:72);
plot(stage,GSm,'r','Linewidth',2.5)
%legend('Prefractionator','Main-column')
hold off

%plot scaled gain GRl for change in Liquid Split ratio
subplot(3,1,3)
GRl = G(:,3);
GRlp = GRl(1:24);
plot(stage1,GRlp,'b','Linewidth',2.5)
xlim([1 50])
ylim([-100 50])
set(gca,'XTick',0:5:50);
set(gca,'YTick',-100:50:50);
xlabel('Stage','FontSize',12,'FontWeight','bold')
ylabel('G (Rl)','FontSize',12,'FontWeight','bold')
title('Scaled gain with respect to liquid split ratio','FontSize',12,'FontWeight','bold')
hold on
GRlm=GRl(25:72);
plot(stage,GRlm,'r','Linewidth',2.5)
%legend('Prefractionator','Main-column')
hold off
