% Script to plot results for pH
% PLotting errors for all
% Callum Kingstree
% Dec 2020

clc; clear all; close all

set(0,'DefaultTextFontName','Times',...
     'DefaultTextFontSize',12,...
     'DefaultAxesFontName','Times',...
     'DefaultAxesFontSize',12,...
     'DefaultLineLineWidth',4,...
     'DefaultLineMarkerSize',7.75,...
     'DefaultStairLineWidth',2)
 
filename = {'cascade.mat','GLT_orig.mat',...
'static.mat','Integrating.mat','GLT_newA.mat'};
linetype = {'-','-','-','-','-'};  
linewidth = [4, 3.5, 3, 2.5,2];

hotpink  = [0.8945    0.4102    0.5898];
peach    = [243/255 146/255 75/255];
coral  = [102/255 214/255 174/255];
lilac = [136/255 122/255 183/255];
orange = [204/255 68/255 10/255];
blue = [0 6/255 102/255];
red = [255/255 89/255 89/255];
lighterblue = [0/255 68/255 178/255];
darkpink = [229/255 57/255 143/255];
minty = [8/255 165/255 105/255];
purple = [59/255 40/255 96/255];
black = [38/255 38/255 38/255];
grey = [120/255 120/255 120/255];
%linecol  = [peach;hotpink; coral; lilac];
linecol  = [peach;hotpink; coral; lilac; blue; purple];

for i =1:length(filename) % plot all saved results
     load(filename{i})
      
     plot(t,error,'Color',linecol(i,:),'LineWidth',linewidth(i),'LineStyle',linetype{i})
     set(gca,'TickLabelInterpreter','latex')
     ylim([-0.60001 0.60001])
    
     ylabel('Error [K]','Interpreter','latex')
     xlabel('Time [s]','Interpreter','latex')
     hold on
end

lgd = legend('Cascade Control','GLT $(A_{tr}=0.61)$','Static','Integrating',...
    'GLT $(A_{tr}=-1/220)$','Interpreter','latex');
lgd.FontSize = 8


x0=10;
y0=10;
width=900;
height=270;
set(gcf,'position',[x0,y0,width,height])

%sgtitle('Disturbance of $q_1$ (unmeasured)','Interpreter','latex')