Solve costFunctionReg.m