
function G=lddet(z)

global M_
 
%% DO NOT CHANGE THIS PART.
%%
%% Here we load the values of the deep parameters in a loop.
%%
NumberOfParameters = M_.param_nbr;                            % Number of deep parameters.
for i = 1:NumberOfParameters                                  % Loop...
  paramname = deblank(M_.param_names(i,:));                   %    Get the name of parameter i. 
  eval([ paramname ' = M_.params(' int2str(i) ');']);         %    Get the value of parameter i.
end                                                           % End of the loop.  
check = 0;
%%

PI=PIbar;
u=1;
q=1;
d=1;
df=1;
sh=1;
si=1;
phi=1;
phif=1;
m=0;
zeta=1;
mu_z=exp(LambdaYd);
mu_I=exp(Lambdamu);
mu_A=exp(LambdaA);
%set the parameter Lambdax
Lambdax=mu_z;

%set the parameter gammma1
gammma1=mu_z*mu_I/betta-(1-delta);

r=1*gammma1;

R=1+(PI*mu_z/betta-1);

%set Rbar
Rbar=R;

PIstar=((1-thetap*PI^(-(1-epsilon)*(1-chi)))/(1-thetap))^(1/(1-epsilon));

mc=(epsilon-1)/epsilon*(1-betta*thetap*PI^((1-chi)*epsilon))/(1-betta*thetap*PI^(-(1-epsilon)*(1-chi)))*PIstar;

w=(1-alppha)*(mc*(alppha/r)^alppha)^(1/(1-alppha));

vp=(1-thetap)/(1-thetap*PI^((1-chi)*epsilon))*PIstar^(-epsilon);
tempvaromega=alppha/(1-alppha)*w/r*mu_z*mu_I;

ld_m= z(1);
ld_f = z(2);
ld_h = z(3);
wm   = z(4);
wf   = z(5);



G=[((( mu_A/mu_z * tempvaromega^alppha)/vp - tempvaromega*(1-(1-delta)*(mu_z*mu_I)^(-1)))*ld_h*(sh * si)*d)^(-1/gammma)*(wm/(varpsi*d*phi))^(1/gammma)-ld_m;
 ((( mu_A/mu_z * tempvaromega^alppha)/vp - tempvaromega*(1-(1-delta)*(mu_z*mu_I)^(-1)))*ld_h*(sh * si)*d)^(-1/gammmaf)*(wf/(varpsif*df*phif))^(1/gammmaf)-ld_f;
  A_wg * (gammmawg * ld_m^rho_mg + (1- gammmawg) * ld_f^rho_mg)^(1/rho_mg)-ld_h;
 (ld_h/(ld_m*A_wg))^(1-rho_mg)*gammmawg*A_wg*w - wm;
 (ld_h/(ld_f*A_wg))^(1-rho_mg)*(1-gammmawg)*A_wg*w - wf];

% ((( mu_A/mu_z * tempvaromega^alppha)/vp - tempvaromega*(1-(1-delta)*(mu_z*mu_I)^(-1)))^(-1)*(wf/(varpsif*phif)))^(1/(1+gammmaf))*(sh*si)^(-gammmaf/(1+gammmaf))-ld_f
