Minimization of a function of more than one variable with equality and inequality constraints.
(xm,fm,theta,lam)=fmincon(optfunc,nge,neq, xin)
(xm,fm,theta,lam)=fmincon(optfunc,nge,neq, xin,showit,itmax,tol)
optfunc The function to be minimized and the constraints. See below.
nge The number of inequality constraints.
neq The number of equality constraints.
xin Initial estimate of the point at which the optimum occurs.
showit Optional. If true, the progress of iterations is printed. Default value is false.
itmax Optional. Maximum number of allowed iterations. Defaults to 200 .
tol Optional. Required accuracy of the solution. Defaults to 1.e-8 .
fm The estimated minimum value.
xm The estimated location of the minimum.
theta The estimated vector of Lagrange multipliers for inequality constraints.
lam The estimated vector of Lagrange multipliers for equality constraints.

fmincon minimizes a function of more than one variable subject to constraints that the specified functions of the solution should be positive or zero.

The function optfunc should be of the form
which returns, for the given input x , the function value, the constraints, and their gradients.

The output f should be a vector, with f[1] being the function to be minimized, f[2:nh+1] the set of inequality constraints, and f[nh+2:ng+nh+1] the set of equality constraints.

The output DF should be a (1+nh+ng)Xn matrix, where n is the size of the input xin . Each row of DF is the gradient of the corresponding function returned in f .
>  From
>  Minmize (x1-1)^2+2(x2+2)^2+3(x3+3)^2
>  subject to
>	  x3-x1^2 >=0
>     and  x3-x1-x2 =1.
>>function (f,df)=func(x)
>	f=[ (x[1]-1)^2+2(x[2]+2)^2+3(x[3]+3)^2
>	       x[3]-x[1]^2
>	       x[3]-x[1]-x[2]-1]
>	df=[2(x[1]-1) 4(x[2]+2)  6(x[3]+3)
>	      -2x[1] 0 1
>	        -1 -1  1]
>>// Estimated solution

>>// Estimated Lagrangian multiplier


>>// Functions and constraints at the estimated optimum