% global RHOV GAMAV
% global RHOH GAMAH
options_.order=2;
options_.periods=0;
options_.nograph=1;
options_.noprint=1;
% options_.steadystate_flag=1; %if 0 ss is recomputed by DYNARE!!
options_.nocorr=0;
options_.ar=0;
options_.nomoments=0;
options_.steadystate.nocheck=1;
% options_.k_order_solver=1;
options_.irf=00;
warning('off','MATLAB:rankDeficientMatrix')
warning('off')
global kappa_MPe kappa_MPc rangeA rangeB range1 range2
%share of imports and value added cannot be too small
% rangeA is set in the
%  rangeA=[0:.1:.4];%[0:2:10];%,20:20:160];
% rangeB=rangeA;
% global range2 range1
% range2=rangeA;%[0.3,0.5,0.7,.9];%0.7,
% range1=rangeB;


pos_UE=find_incell(M_.endo_names,'\<UE\>');
pos_UC=find_incell(M_.endo_names,'\<UC\>');
pos_Util=find_incell(M_.endo_names,'\<Util\>');
pos_tau_e=find_incell(M_.endo_names,'\<tau_k_e\>');
pos_tau_c=find_incell(M_.endo_names,'\<tau_k_c\>');
pos_Ce=find_incell(M_.endo_names,'\<Ce\>');
pos_Cc=find_incell(M_.endo_names,'\<Cc\>');
pos_R_b=find_incell(M_.endo_names,'\<R_b\>');
pos_R_c=find_incell(M_.endo_names,'\<R_c\>');
positions=[pos_UE;pos_UC;pos_Util;pos_tau_e;pos_tau_c;pos_R_b;pos_R_c];

pos_param1=find_incell(M_.param_names,'\<kappa_MPe\>');
pos_param2=find_incell(M_.param_names,'\<kappa_MPc\>');

%initialize matrices
tmpsz=zeros(length(range1),length(range2));
results=zeros(length(range1),length(range2),length(positions));

% penalty_MX=tmpsz;
% hwb= waitbar(0,'Please wait...');
if labindex==1
    progress('init');
end
zwaitbar=1;
total_loops=length(range1)*length(range2);



%  keyboard


for cntjj=1:length(range1);
    kappa_MPe =range1(cntjj);
    M_.params(pos_param1)=kappa_MPe;
    for cntkk=1:length(range2);
        kappa_MPc =range2(cntkk);
        M_.params(pos_param2)=kappa_MPc;
        
        
        if cntkk==1&&cntjj==1;
            timestart=tic;
        end
        
%  try       
        
        
        
