Guest User

Untitled

a guest
Mar 17th, 2018
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.55 KB | None | 0 0
  1. %% Generate Data
  2.  
  3. vX = paramMu + (sqrt(paramSigmaSq) * randn([numSamples, 1]));
  4. vEmpMoment = zeros([numMoments, 1]);
  5.  
  6.  
  7. %% Generating Empirical Moments
  8.  
  9. for ii = 1:numMoments
  10. vEmpMoment(ii) = mean(vX .^ ii);
  11. end
  12.  
  13. hResFun = @(vTheta) ResFun(numMoments, vTheta(1), vTheta(2), vEmpMoment);
  14. vTheta = [0, 1];
  15.  
  16. sSolverOptions = optimoptions('lsqnonlin', 'Algorithm', 'trust-region-reflective', 'FunctionTolerance', 1e-9, 'StepTolerance', 1e-9, 'FiniteDifferenceType', 'central', 'Display', 'iter');
  17.  
  18. vTheta = lsqnonlin(hResFun, vTheta, [], [], sSolverOptions);
Add Comment
Please, Sign In to add comment