Lagrange Multiplier - Using - Fmincon
Lagrange Multiplier - Using - Fmincon
Lagrange Multiplier - Using - Fmincon
b and beq are vectors, A and Aeq are matrices, c(x) and ceq(x) are functions that return vectors, and f(x)
is a function that returns a scalar. f(x), c(x), and ceq(x) can be nonlinear functions.
x, lb, and ub can be passed as vectors or matrices; see Matrix Arguments.
example
x = fmincon(fun,x0,A,b) starts at x0 and attempts to find a minimizer x of the function described
in fun subject to the linear inequalities A*x ≤ b. x0 can be a scalar, vector, or matrix.
Suppose you want to maximize the function f(x, y) = x^2 + y^2 subject
to the constraint g(x, y) = x + y - 1 = 0.
Here's how you can implement it using Lagrange multipliers:
% Objective function
% Initial guess
x0 = [0.5, 0.25];
>> Lagrange_multiplier_using_fmincon
First-order Norm of
In this example, fun is the objective function, and nonlcon is the equality
constraint. The fmincon function is then used to find the optimal solution subject
to the given equality constraint.