This is a fairly general template for doing GMM estimation in Matlab, prepared for Wayne Ferson's empirical asset pricing course at USC Marshall.