function Out = ex4_opt(Init, UncVar)
persistent X F gamma;
switch Init
    case 'objective'
        Out = cell(0);
        X = sdpvar(2,2,'sy'); F = sdpvar(1,2,'f');
        gamma = sdpvar(1);
        Out{1} = gamma; Out{2} = X;
        Out{3} = F; Out{4} = gamma;
    case {1, 'init'}
        UncVar = cell(0);
        UncVar{1} = ubase('m', ...
                          'real_scalar_uniform', ...
                          'nominal', 3, ...
                          'range', 0.5);
        UncVar{2} = ubase('d', ...
                          'real_scalar_uniform', ...
                          'nominal', 2, ...
                          'range', 0.5);
        UncVar{3} = ubase('k', ...
                          'real_scalar_uniform', ...
                          'nominal', 2, ...
                          'range', 0.5);
        Out = UncVar;
    case {0, 'constr'}
        Out = cell(1);
        m = UncVar{1}; d = UncVar{2}; k = UncVar{3};
        A = [0 1; -k/m -d/m]; B = [0; 1/m];
        Q = eye(2); R = 1; S = eye(2);
        Phi = A*X+B*F;
        LMI = set([]);
        LMI = LMI + set([Phi+Phi', X, F';
                         X, -inv(Q), [0; 0];
                         F, [0, 0], -inv(R)] <= 0);
        Out{1} = LMI + set([-X, eye(2);
                            eye(2), -gamma*S] <= 0);
end