I believe you want
f1 = 0.5*length(x)*log(2*pi*(y(2)));
You start with 1/sqrt(2*pi*sigma^2), then take logs so you get a minus sign, but you need to negate again to get the negative log likelihood that you can minimize.
Also try setting lb(2)=eps.
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!