clc; clear;
global oo_ M_ options_ y_

dynare Rec1.mod noclearall;

ord_c=1; dyn.c = oo_.dr.inv_order_var(ord_c);
ord_y=1; dyn.y = oo_.dr.inv_order_var(ord_y);

rng('default');rng(201601);
shockMat = (mvnrnd([0],[1],15000));
 
empMom = [  0.0186814643136072;
            0.0182442003860001;
            0.00144284560276217;
            0.00065330499615283]; %mean  var of dy dc
        
x0=[BETTA;GAM;SIG;SIGZ];
lb0 = [0;0;0;0];                
ub0 = [1.5;Inf;Inf;Inf];

%ytest=Objfn(x0,targetMom,shockMat,dyn);
[est1,fval,exitflag,output] = patternsearch({@Objfn,empMom,shockMat,dyn},x0,[],[],[],[],lb0,ub0,[]);
