Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

New to MATLAB?

Optimization Constraints

Asked by George

George

on 15 Nov 2011
Accepted Answer by George

George

Hi

I want to find a solution of the following problem.

min 1/2 * x'*Q*x - f*x' s.t. sum(x) = 0 sum(abs(x)) = 1

I am using the function quadprog but i don't know how to give the second constraint the one with the absolute.

Is there a way to give such constraints in quadprog or fmincon or some other matlab optimization function??

Any help would be appreciated

Thanks George

0 Comments

George

George

Products

No products are associated with this question.

1 Answer

Answer by George

George

on 16 Nov 2011
Accepted answer

I think i can use the argument nonlcon in fmincon function.

function [cineq ceq] = nonlcon(x)
ceq sum(abs(x))-1;
cineq = [];
end
fmincon(@myfun,A,b,Aeq,beq,lb,ub,@nonlcon,options); 

Anyone can confirm that?

0 Comments

George

George

Contact us