function [x]=mark_opt_besser(datenvektor,j,k,koschiefe)

x0 = 0.05*ones(j,1);   %starting vektor [0.2;0.2]
lb = 0.05*ones(j,1);      %lower boundaries [0;0];  0.15*ones(j,1);
ub=  ones(j,1);       %upper boundaries [1;1];
A=-datenvektor{1,k}{5,1}';
b=-0.05;
Aeq= ones(1,j);
beq= 1;


%----------------------------------------------------------


z=@(x) (gfun(x, datenvektor, j, k)+hfun(x, datenvektor, j, k))^(1/2);
%----------------------------------------------------------
[x,fval,exitflag]=fmincon(z,x0,A,b,Aeq,beq,lb,ub,@(x) mycon(x, j, koschiefe)) ;

function g = gfun(x, datenvektor, j, k)
g= 0;
for i=1:j
    g= g +x(i)^2*datenvektor{1,k}{3,1}(i,i);
end

%---------------------------------------------------------
function h = hfun(x, datenvektor, j, k)
h=0;
for i=1:(j-1)
    for p=(i+1):j
        h= h +2*x(i)*x(p)*datenvektor{1,k}{3,1}(i,p);
    end
end


function [c ceq]=mycon(x,j,koschiefe)
%Nichtlineare Nebenbedingung

c=0;
for i=1:j
    for p=1:j
        for q=1:j
            c=c+((x(i)*x(p)*x(q)*koschiefe(i,p,q)));
        end
    end
end
ceq=[];
c=-c+0.3;










