MATLAB: How can i fix this error ? Failure in initial user-supplied objective function evaluation. FMINUNC cannot continue.

fminunc

f = @(x1,x2) (1 + (x1 + x2 + 1).^2.*(19 – 14*x1 + 3*x1.^2 – 14*x2 + 6*x1.*x2 + 3*x2.^2)).*…
(30 + (2*x1 – 3*x2).^2.*(18 – 32*x1 + 12*x1.^2 + 48*x2 – 36*x1.*x2 + 27*x2.^2));
x0=[1,1];
[x,fval] = fminunc(f,x0)

Best Answer

f=@(x)(1 + (x(1) + x(2) + 1).^2.*(19 - 14*x(1) + 3*x(1).^2 - 14*x(2) + 6*x(1).*x(2) + 3*x(2).^2)).*...
(30 + (2*x(1) - 3*x(2)).^2.*(18 - 32*x(1) + 12*x(1).^2 + 48*x(2) - 36*x(1).*x(2) + 27*x(2).^2));
Best wishes
Torsten.