Hi, i'm trying to estimate the parameters of log likelihood function by using fminsearch. i have three parameters; x(1),x(2),x(3) and the set of valid parameters for x(1)-->[0,20] , for x(2)---> [0,1000], for x(3)---> [0,5000]. i want to find the estimated parameters in this set. So i have to add some conditions to fminsearch. Namely, to discourage the algorithm from finding local minumum outside the set of valid parameters, i have to define the log likelihood to be negative infinity for values outside this set. Then i have to restart the algorithm until no improvement could be found in 20 consecutive runs. But i don't know how to do this. Is this possible?? for fminsearch, my starting point x0:[20*rand,1000*rand,5000*rand]. Can anyone please help me??