
function easy_plot(res,con_space_1,con_space_2)

cost_vec=[];
ks_vec=[];
delay_vec=[];

for i=2:length(res.pid.cost)
    
    
      %if res.pid.margins(i).Stable == 0
      if res.pid.exitflag(i,1) <= 0
           cost_vec=[cost_vec NaN];
         ks_vec=[ks_vec res.pid.mks(i)];
         delay_vec=[delay_vec min(res.pid.margins(i).DelayMargin)];
      else
         cost_vec=[cost_vec res.pid.cost(i)];
         ks_vec=[ks_vec res.pid.mks(i)];
         delay_vec=[delay_vec min(res.pid.margins(i).DelayMargin)];
      end
        
    
    
end
% 
% con_space_1 = 44:1:56; %KS
% con_space_2 = 2.4:-0.1:1;
[X,Y]= meshgrid(con_space_1,con_space_2);
z=reshape(cost_vec,length(con_space_2),[]);

%cost_vec=reshape(cost_vector,,)
figure(1)
 mesh(X,Y,z)
  xlabel('KS')
 ylabel('Mt')
 zlabel('ISE')
   zlim([0 2])
 figure(2)
 surf(X,Y,z)
 xlabel('KS')
 ylabel('Mt')
 zlabel('ISE')
 figure(3)
 contour(X,Y,z,100)
 colorbar
 xlabel('KS')
 ylabel('Mt')
 tilefigs
 end