Create checkCostFunction.m