clear all
u1vec=linspace(0.0001,1.5,40);
u2vec=linspace(0.000000,1.5,40);
k1=0.65;
k2=0.014;
dn=[k1; k2];
 dn=[3.0000 ;   0.1000]

for j=1:length(u1vec)
   
    for i=1:length(u2vec)
       
        u1=u1vec(j);
        u2=u2vec(i);
        
        u=[u1;u2];
        [J,~,~,~]  = objective(u,dn);
        Jmatrix(j,i)=J;
        U1(j,i)=u1;
        U2(j,i)=u2;
        
        
    end
    
end


mesh(U1,U2,Jmatrix)
xlabel('u1')
xlabel('u2')
zlabel('cost')

%% plot optimal surface
clear all
k1vec=linspace(0.3,3,40);
k2vec=linspace(1e-3,1e-1,40);



for j=1:length(k1vec)
   
    for i=1:length(k2vec)
       
        k1=k1vec(j);
        k2=k2vec(i);
        dn=[k1; k2];
      
       
%         [J,~,~,~]  = objective(u,dn);
        [J,~,~,~]=getOptimum(dn);
        Jmatrix(j,i)=J;
        U1(j,i)=k1;
        U2(j,i)=k2;
        
        
    end
    
end


mesh(U1,U2,Jmatrix)
xlabel('k1')
xlabel('k2')
zlabel('J opt')