Create OldcheckCostFunction.m