This function is experimental and not supported by us yet. If you are looking for a simulated method of moments, please have a look at the replication files for Born/Pfeifer (2014): “Risk Matters: A comment” at sites.google.com/site/pfeiferecon/20140525_replication_codes.zip?attredirects=0. There, we use SMM to estimate a third-order approximated model.
As far as I understand your code right, you do not use a weighting matrix. If I want to use a weighting matrix, how do I have to change the code to insert one?
% compute objective function
fval=(simulated_moments-target)*(simulated_moments-target)'
Implicitly, this is
% compute objective function
fval=(simulated_moments-target)/eye(n,n)*(simulated_moments-target)'
You would need to replace the identity in the middle with your weighting matrix, derived e.g. using a Newey-West type estimator. See Ruge-Murcia’s codes for an example.