%% Obtain Minimax Value
% Obtain both the location of the minimax point and the value of the objective functions. 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];

% Set the initial point to [0,0] and find the minimax point and value.

x0 = [0,0];
[x,fval] = fminimax(fun,x0)

% All three objective functions have the same value at the minimax point. Unconstrained problems typically have at least two objectives that are equal at the solution, because if a point is not a local minimum for any objective and only one objective has the maximum value, then the maximum objective can be lowered.
% Copyright 2018 The MathWorks, Inc.