% FILENAME : CON_TOUR.M
% BY : RENO CIPOLLA
% DATE : MARCH 1994 
% VERSION 2.0
% COPYRIGHT 1994-5 by T. Marlin and R. Cipolla
% This file creates vectors for a contour plot of defined levels of IAE, ISE and ITAE  
% (or the objective function) for a range of Kc and Ti.
% ************************************************************************************


if chg == 'd'
  betaa=tdist; change=1;
else
  betaa=tset;  change=2;
end
clc
disp('')
disp('')
disp('')
disp('')
disp('')
disp('')
disp('')
disp('')
disp('  Creating contour plot, please wait several moments ...... ')

pp=0;mm=-1;p=1;useopt=0;op_ts=1;scn_t=1;cn_t=1; usegrh=2; 
mvbound1
ss=zeros(int_kc+1,int_ti+1); ss1=ss; ss2=ss1; ss3=ss2;
v0=zeros(1,numlev); v1=v0; v2=v1; v3=v2;
junk2 = 2;         % ensure that control execution consistent with Y0
Y0 = [kc ti];
nom = integ4a(Y0);
nom1 = sum(Qp(:,1));
nom2 = sum(Qp(:,2));
nom3 = sum(Qp(:,3));

Ca=0; Cb=0;
for i=c_1:c_i:c_2
  Ca=Ca+1;
  Cb=0;
   for j=b_1:b_i:b_2
          Cb=Cb+1;
          Y0=[i j];
          ss(Ca,Cb)= integ4a(Y0);
          ss1(Ca,Cb)= sum(Qp(:,1));
          ss2(Ca,Cb)= sum(Qp(:,2));
          ss3(Ca,Cb)= sum(Qp(:,3));
   end
end
%ss=flipud(ss);
%ss1=flipud(ss1);
%ss2=flipud(ss2);
%ss3=flipud(ss3);

for a =1:1:numlev 
 v0(a)= le_vel(a)*nom;
 v1(a)= le_vel(a)*nom1;
 v2(a)= le_vel(a)*nom2;
 v3(a)= le_vel(a)*nom3;
end
ct_count= 1;
