
function distance=mfile(parameters)


% a script change the parameters of the dynare file 
change_dynare_script(parameters)
% call dynare for each parameters 
dynare dynare_script_SMM.mod
% load dynare results
load('dynare_script_SMM_results.mat');


%% simulate , feed shocks
    
initial_condition_states = repmat(oo_.dr.ys,1,M_.maximum_lag);
shock_matrix = zeros(simul_periods,M_.exo_nbr); %create shock matrix with number of time periods in columns
r = simult_(M_,options_,initial_condition_states,oo_.dr,shocks',options_.order);
periods = simul_periods;
    

% code for calculate distance, using weighting matrix and so forth..

x = (r(find(strcmp(M_.endo_names,'x')),starting:end))';
y = (r(find(strcmp(M_.endo_names,'y')),starting:end))';
distance = ;

end
