You are on page 1of 2

E=x1 −x2 + 4 x 21+ 4 x 1 x 2 + x 22

x1 , x2 ≥ 0

Constrain :
x 1+ x2 ≤2

−x 1+ 2 x 2 ≤ 2

2 x1 +2 x 2 ≤ 3

[ x1 x2 ] [ 40 41] → H =[ 40 41 ]
Ax=B
¿
¿
¿
Source Code Matlab:
figure (1)
xm = 0:0.1:5;
ym = 0:0.1:5;
[x,y] = meshgrid(xm,ym);
f = 4*x.^2+y.^2-x.*y-1*x-1*y;
mesh(x,y,f)
f = x + y -2;
hold on
mesh(x,y,f)
hold on
f =-x +2*y -2;
mesh(x,y,f)
f = 2*x + 2*y -3;
hold on
mesh(x,y,f)
hold off
H = [4 4; 0 1]
f = [-1; -1]
A = [1 1; -1 1; 2 2]
b = [2; 2; 3]
lb = zeros(2,1)
[x,fval,exitflag,output,lamda]= quadprog(H,f,A,b,[],[],lb)

Grafik :

You might also like