This matlab code is to implementat optimisation