欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

Matlab fmincon函数

程序员文章站 2024-03-19 08:16:34
...

函数功能

获取约束的非线性多变量函数的最小值
样式:
Matlab fmincon函数
其中,c(x), ceq(x) 分别表示非线性的约束条件,而A, Aeq表示的是线性约束。

函数表达及用法

x = fmincon(fun,x0,A,b,Aeq,beq,lb,ub,nonlcon,options)
  1. fun
    minimizes fun
  2. 初始值
    starts at x0,x0 can be a scalar, vector, or matrix.
  3. 线性约束
    attempts to find a minimizer x of the function described in fun subject to the linear inequalities Ax ≤ b,Aeqx = beq,and the range lb ≤ x ≤ ub
  4. 非线性约束
    the nonlinear inequalities c(x) or equalities ceq(x) defined in nonlcon
    For example,
    x = fmincon(@myfun,x0,A,b,Aeq,beq,lb,ub,@mycon)
    where mycon is a MATLAB function such as
    function [c,ceq] = mycon(x)
    c = ...     % Compute nonlinear inequalities at x.
    ceq = ...   % Compute nonlinear equalities at x.
    
  5. 选项
    Optimization options, specified as the output of optimoptions or a structure such as optimset returns
    Matlab fmincon函数
    Matlab fmincon函数Matlab fmincon函数Matlab fmincon函数Matlab fmincon函数
  6. Algorithm
    Matlab fmincon函数

返回值

[x,fval,exitflag,output,lambda,grad,hessian] = fmincon(___) additionally returns:

x— variable
fval— the value of the objective function fun
exitflag— describes the exit condition of fmincon,
output— a structure output with information about the optimization process.
lambda — Structure with fields containing the Lagrange multipliers at the solution x.
grad — Gradient of fun at the solution x.
hessian — Hessian of fun at the solution x. See fmincon Hessian.
  1. exitflag
    Matlab fmincon函数
  2. output
    Matlab fmincon函数
  3. lambda
    Matlab fmincon函数
  4. Hessian
    Matlab fmincon函数