%% Find Minimax Subject to Nonlinear Constraints
% The objective functions for this example are linear plus constants. For a description and plot of the objective functions, see Compare fminimax and fminunc.
% Set the objective functions as three linear functions of the form {\rm dot}(x,v) + v_0 for three vectors v and three constants v_0.

a = [1;1];
b = [-1;1];
c = [0;-1];
a0 = 2;
b0 = -3;
c0 = 4;
fun = @(x)[x*a+a0,x*b+b0,x*c+c0];

% The unitdisk function represents the nonlinear inequality constraint \|x\|^2 \le 1.

type unitdisk

% Solve the minimax problem subject to the unitdisk constraint, starting from x0 = [0,0].

x0 = [0,0];
A = []; % No other constraints
b = [];
Aeq = [];
beq = [];
lb = [];
ub = [];
nonlcon = @unitdisk;
x = fminimax(fun,x0,A,b,Aeq,beq,lb,ub,nonlcon)

% Copyright 2018 The MathWorks, Inc.