Question

I need to minimize alpha in using quadprog in matlab

1/2*alpha.'*H*alpha+(-1.')*alpha

subject to: y.'alpha=0 and 0<=alpha<=inf

I have made the matrix H

    for a=1:8

    for b=1:8

    H(a,b)=y(a)*y(b)*dot((x(a)).',x(b));

    end

end

but I am unsure have to make the constraints

Was it helpful?

Solution

Does this work?

n = size(H,1);
f = -ones(n,1);       // linear term
aeq = randn(1,n);     // equality constraint
lb = zeros(n,1);      // lower bound
ub = inf * ones(n,1); // upper bound
alpha = quadprog(H,f,[],[],aeq,0,lb,ub)
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top