 mpcFig = figure('Name','MPC','Position',[1 1 scrsz(3) scrsz(4)]);
scrsz = get(0,'ScreenSize')/1;
[p1,p2]=plotall_subplot(yunc,uunc,ts,[2 3 1 4])
title(p1,sprintf('ywt = %d,   uwt = %d,   Input horizon = %d,   Pred. horizon = %d',ywt,uwt,hM,hP),'FontSize',12)
title(p2,sprintf('lower bound = %d, upper bound = %d',-Inf,Inf),'FontSize',12)
xlabel(p1,'Time (sec)','FontSize',12)
xlabel(p2,'Time (sec)','FontSize',12)
ylabel(p1,'Output','FontSize',12)
ylabel(p2,'Manipulated Variable','FontSize',12)

[p3,p4]=plotall_subplot(ycon,ucon,ts,[2 3 2 5])
title(p3,sprintf('ywt = %d,   uwt = %d,   Input horizon = %d,   Pred. horizon = %d',ywt,uwt,hM,hP),'FontSize',12)
title(p4,sprintf('lower bound = %d, upper bound = %d',umin,umax),'FontSize',12)
xlabel(p3,'Time (sec)','FontSize',12)
xlabel(p4,'Time (sec)','FontSize',12)
ylabel(p3,'Output','FontSize',12)
ylabel(p4,'Manipulated Variable','FontSize',12)
text(2,30,'optimization problem solved without constraints','FontSize',10)

[p5,p6]=plotall_subplot(ycmpc,ucmpc,ts,[2 3 3 6])
title(p5,sprintf('ywt = %d,   uwt = %d,   Input horizon = %d,   Pred. horizon = %d',ywt,uwt,hM,hP),'FontSize',12)
title(p6,sprintf('lower bound = %d, upper bound = %d',umin,umax),'FontSize',12)
xlabel(p5,'Time (sec)','FontSize',12)
xlabel(p6,'Time (sec)','FontSize',12)
ylabel(p5,'Output','FontSize',12)
ylabel(p6,'Manipulated Variable','FontSize',12)
text(2,30,'optimization problem solved with constraints','FontSize',10)

% axis([p3,p5],[0 tend 0  1.5 ])
% axis([p4,p6],[0 tend -10  60])