The fmincon function finds the minimum of a constrained nonlinear multivariable function subject to bounds and linear and nonlinear constraints. It uses either a medium-scale or large-scale algorithm depending on whether the gradient of the objective function is provided. The user defines the objective function fun and optional nonlinear constraints nonlcon, both of which can return gradient and Hessian information. Fmincon returns the optimized values, objective function value, exit condition, and additional output details.